Reputation: 45
i am importing csv file to delete the mysql database according articleno but its not deleting
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]).';
mysql_query("DELETE from contacts where articleno = $fss ");
}
}
Upvotes: 0
Views: 55
Reputation: 55
Because $fss is inserted in a string it doesn't have to be a string. Removing the quotes around the variable should suffice
Try checking what $fss is after setting it to 'addslashes($data[1])'. Is it the value you thought it would be?
Upvotes: 0
Reputation: 3731
$fss = '.addslashes($data[1]).';
Change it to
$fss = addslashes($data[1]);
because now your query looks like
DELETE from contacts where articleno = .addslashes($data[1]).
:)
Upvotes: 1
Reputation: 37233
change this
$fss = '.addslashes($data[1]).';
to
$fss = addslashes($data[1]);
Upvotes: 1