我正在使用echo $fss
显示数据
“11-V5703211-V5703211-V5703211-V5703211-V5703211-V5703211-V5703211-V5703211-V5703211-V5703211-V5703211-V5703211-V5703211-V5703211-V5703211-V5703211-V5703211-V5703211-V57032”
但是我使用的是使用此变量的删除查询,但它无法正常工作
<?php
//connect to the database
$connect = mysql_connect("localhost","root","");
mysql_select_db("cityshoes",$connect); //select the table
if ($_FILES[csv][size] > 0) {
//get the csv file
$file = $_FILES['csv']['tmp_name'];
$handle = fopen($file,"r");
do {
if ($data[0]) {
$fss = addslashes($data[1]);
$result = mysql_query("DELETE from contacts where articleno = . $fss . ");
echo $fss;
}
} while ($data = fgetcsv($handle,1000,",","'"));
}
?>
答案 0 :(得分:3)
您在查询中以错误的方式附加变量。试试:
$result = mysql_query("DELETE from contacts where articleno = $fss");
或
$result = mysql_query("DELETE from contacts where articleno ='".$fss ."'");
答案 1 :(得分:0)
转动此行
$result = mysql_query("DELETE from contacts where articleno = . $fss . ");
到此
$result = mysql_query("DELETE from contacts where articleno = $fss ");
您必须删除期间。