0

I am using echo $fss its display data

"11-V5703211-V5703211-V5703211-V5703211-V5703211-V5703211-V5703211-V5703211-V5703211-V5703211-V5703211-V5703211-V5703211-V5703211-V5703211-V5703211-V5703211-V5703211-V57032"

but i am using delete query using this variable but its not working

<?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,",","'")); 



} 

?> 
Phil
  • 157,677
  • 23
  • 242
  • 245
user911712
  • 45
  • 4
  • 1
    [Why shouldn't I use mysql_* functions in PHP?](http://stackoverflow.com/questions/12859942/why-shouldnt-i-use-mysql-functions-in-php) – Phil Mar 27 '14 at 04:29

2 Answers2

3

You are appending variable in the query in wrong way. Try with:

$result = mysql_query("DELETE from  contacts where articleno = $fss");

or

$result = mysql_query("DELETE from contacts where articleno ='".$fss ."'");
Jenz
  • 8,280
  • 7
  • 44
  • 77
0

Turn this line

$result = mysql_query("DELETE from  contacts where articleno = . $fss . ");

To this

$result = mysql_query("DELETE from  contacts where articleno =  $fss ");

You have to remove the periods.

  • $result = mysql_query("DELETE from contacts where articleno = $fss "); i changes to it but still not deleting any thing wrong in do while loop – user911712 Mar 27 '14 at 04:35
  • Have you paste that sql command into phpmyadmin and replaced $fss with sample code to test to make sure the string works? – Tyler's Lounge Mar 27 '14 at 04:38