PDA

View Full Version : syntax error (more help :D)


MintDanny
02-09-2007, 10:42 AM
Hey,

i am just finsihed the delete data tutorial and i am getting this error

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 'where field1_id='1'' at line 1

now i havent a clue what this means.

any help is appreciated

Danny

davidj
02-09-2007, 10:49 AM
paste the code you have in your delete script

MintDanny
02-09-2007, 11:14 AM
Hey,

here is the php

if ($del){
////////////////////////////////////////////////////
$query = sprintf("DELETE FROM where field1_id='$del'");
mysql_query($query)or die(mysql_error());
/////////////////////////////////////////////////////

}


and the actaul button is here;

<input type="button" name="Submit2" value="Delete" onClick="document.location.href='dwc.php?del=<?php echo $row['field1_id'] ?>'" />

davidj
02-09-2007, 12:57 PM
you are not telling the SQL where to delete from

you are missing a table

delete from table where