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?

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.

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

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.