0
DELETE * FROM image_upload WHERE image_id=51You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '* FROM image_upload WHERE image_id=51' at line 1


if(!empty($_GET['image_id']))
    {

    $sqlstr = "DELETE * FROM image_upload WHERE image_id=".$_GET['image_id'];

    //echo $sqlstr;

    $result = mysql_query($sqlstr) or die(mysql_error());


    $confirmation = ($result) ? "Data has been saved." : "Fail to save data.";
    } 

Why there is that You have an error in your SQL syntax?

3
Contributors
2
Replies
14
Views
2 Years
Discussion Span
Last Post by rch1231
1

For the single-table syntax, the DELETE statement deletes rows from tbl_name and returns a count of the number of deleted rows.

What would be the use of a *?

Also, mysql_query is deprecated and the way you are using it is dangerous.

0

WHat he is trying to say is the query should be:

$sqlstr = "DELETE FROM image_upload WHERE image_id=".$_GET['image_id'];

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.