cty Posted March 3, 2007 Share Posted March 3, 2007 can anyone help me to edit it to correct form? $query="insert into book(buyer) values('".$x."')where id=".$book; Link to comment https://forums.phpfreaks.com/topic/40982-sql-syntax/ Share on other sites More sharing options...
The14thGOD Posted March 3, 2007 Share Posted March 3, 2007 $query="INSERT INTO book (buyer) values ('$x')where id='$book' "; that should work, but with my luck tonight prolly not lol Link to comment https://forums.phpfreaks.com/topic/40982-sql-syntax/#findComment-198432 Share on other sites More sharing options...
play_ Posted March 3, 2007 Share Posted March 3, 2007 Someone beat me to it =D Link to comment https://forums.phpfreaks.com/topic/40982-sql-syntax/#findComment-198433 Share on other sites More sharing options...
play_ Posted March 3, 2007 Share Posted March 3, 2007 14thGOD's line won't work properly though. change 'VALUES' to 'VALUE' and put a space between ) and where Link to comment https://forums.phpfreaks.com/topic/40982-sql-syntax/#findComment-198435 Share on other sites More sharing options...
The14thGOD Posted March 3, 2007 Share Posted March 3, 2007 whoops hah I have VALUES in all my insert statements...and havn't gotten an error, forgot the space though =D Link to comment https://forums.phpfreaks.com/topic/40982-sql-syntax/#findComment-198442 Share on other sites More sharing options...
play_ Posted March 3, 2007 Share Posted March 3, 2007 It won't give an error, but it'll affect the data inserted (if i remember correctly) I remember going nuts once because my query wasn't giving me the desired results, and i realized i had VALUES when i was only inserting a single value. so i changed it to VALUE and it worked fine. Link to comment https://forums.phpfreaks.com/topic/40982-sql-syntax/#findComment-198445 Share on other sites More sharing options...
The14thGOD Posted March 3, 2007 Share Posted March 3, 2007 oh, I didn't think about the single value, ive always inserted multiple values, good to know though, thanks =D Link to comment https://forums.phpfreaks.com/topic/40982-sql-syntax/#findComment-198446 Share on other sites More sharing options...
play_ Posted March 3, 2007 Share Posted March 3, 2007 Yea. This is all too long ago. I'm pretty sure it was what i did to solve the problem i was having. Link to comment https://forums.phpfreaks.com/topic/40982-sql-syntax/#findComment-198448 Share on other sites More sharing options...
play_ Posted March 3, 2007 Share Posted March 3, 2007 or maybe, i had VALUE instead of VALUES.....yea...i'm pretty sure that's it. ignore my previous posts =D Link to comment https://forums.phpfreaks.com/topic/40982-sql-syntax/#findComment-198449 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.