RE: [PHP] error when trying to delete a record

2005-07-11 Thread Jay Blanchard
[snip] Is the above statement true when the id field is numeric (which it surely is in this case)? I get the expected results (in mySQL) when using statements like SELECT name FROM table WHERE id=1 with no single quotes round it. Putting quotes round integer values is counter-intuitive - is it ne

RE: [PHP] error when trying to delete a record

2005-07-11 Thread Mike Johnson
From: Paul Waring [mailto:[EMAIL PROTECTED] > On Mon, Jul 11, 2005 at 03:25:33PM +0100, Mark Rees wrote: > > with no single quotes round it. Putting quotes round > > integer values is counter-intuitive - is it necessary > > in some cases? > > If the field is a numeric type (e.g. INT) as oppose

Re: [PHP] error when trying to delete a record

2005-07-11 Thread Paul Waring
On Mon, Jul 11, 2005 at 03:25:33PM +0100, Mark Rees wrote: > with no single quotes round it. Putting quotes round integer values is > counter-intuitive - is it necessary in some cases? If the field is a numeric type (e.g. INT) as opposed to numeric data being stored in a character field (e.g. a te

Re: [PHP] error when trying to delete a record

2005-07-11 Thread Mark Rees
""Jay Blanchard"" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] [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

Re: [PHP] error when trying to delete a record

2005-07-11 Thread John Nichel
Ross wrote: I dunno if my text book is out of date or I have made a syntax error but I am trying to delete a record with $query= "DELETE FROM sheet1 WHERE id=$id"; $result= mysql_query($query); if($result){ echo "it was deleted"; } else echo mysql_error(); } and I get the followi

RE: [PHP] error when trying to delete a record

2005-07-11 Thread Jay Blanchard
[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