Nymphetamine Posted August 29, 2008 Share Posted August 29, 2008 Hi there, I've just added a field to a UPDATE WHERE statement, and I keep getting this stupid 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 date = '0501'' at line 2 I can't remember exactly what else I've done to my code, but I've tried retracing my steps and this error just wont go away! And its not even on line 2... its on line 42 or something. Can someone check my code? Might just be something simple I've missed. $mysql = array(); $mysql['address'] = mysql_real_escape_string( $address ); mysql_query("UPDATE $property SET booked = '$booked', date = '$date', name = '$name', adults = '$adults', children = '$children', babies = '$babies', address = ( '{$mysql['address']}' ), daytime = '$daytime', evening = '$evening', mobile = '$mobile', email = '$email', find = '$find', cot = '$cot', chair = '$chair', linen = '$linen', cleaning = '$cleaning', catering = '$catering', other = '$other', totalholiday = '$totalholiday', depositagreed = '$depositagreed', firstagreed = '$firstagreed', secondagreed = '$secondagreed', thirdagreed = '$thirdagreed', due = '$due', depositreceived = '$depositreceived', firstreceived = '$firstreceived', secondreceived = '$secondreceived', thirdreceived = '$thirdreceived', duereceived = '$duereceived', totalreceived = '$totalreceived', WHERE date = '$date'") or die(mysql_error()); Thank yoooo! Quote Link to comment https://forums.phpfreaks.com/topic/121804-solved-annoying-mysql-error/ Share on other sites More sharing options...
Ken2k7 Posted August 29, 2008 Share Posted August 29, 2008 Try: <?php $mysql = array(); $mysql['address'] = mysql_real_escape_string( $address ); mysql_query("UPDATE $property SET booked = '$booked', date = '$date', name = '$name', adults = '$adults', children = '$children', babies = '$babies', address = '{$mysql['address']}', daytime = '$daytime', evening = '$evening', mobile = '$mobile', email = '$email', find = '$find', cot = '$cot', chair = '$chair', linen = '$linen', cleaning = '$cleaning', catering = '$catering', other = '$other', totalholiday = '$totalholiday', depositagreed = '$depositagreed', firstagreed = '$firstagreed', secondagreed = '$secondagreed', thirdagreed = '$thirdagreed', due = '$due', depositreceived = '$depositreceived', firstreceived = '$firstreceived', secondreceived = '$secondreceived', thirdreceived = '$thirdreceived', duereceived = '$duereceived', totalreceived = '$totalreceived' WHERE date = '$date'") or die(mysql_error()); ?> Quote Link to comment https://forums.phpfreaks.com/topic/121804-solved-annoying-mysql-error/#findComment-628435 Share on other sites More sharing options...
sasa Posted August 29, 2008 Share Posted August 29, 2008 remove last , (one before WHERE) Quote Link to comment https://forums.phpfreaks.com/topic/121804-solved-annoying-mysql-error/#findComment-628438 Share on other sites More sharing options...
Nymphetamine Posted August 29, 2008 Author Share Posted August 29, 2008 Ahhh cheers lol. Knew it would be simple Quote Link to comment https://forums.phpfreaks.com/topic/121804-solved-annoying-mysql-error/#findComment-628441 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.