RE: error when trying to delete a record

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[snip]
$query= "DELETE FROM sheet1 WHERE id=$id";

You have an error in your SQL syntax; check the manual that corresponds
to 
your MySQL server version for the right syntax to use near '' at line 1 
[/snip]

try...

$query= "DELETE FROM sheet1 WHERE id = '".$id."' ";

Note the single quotes around conditional data. Imagine if $id = 1 and
you did your original query, it would read...

$query= "DELETE FROM sheet1 WHERE id=1"; 

Which is where id = TRUE. You could end up deleting all of the records
in the database.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux