Jump to content

[SOLVED] Annoying MySQL error....


Nymphetamine

Recommended Posts

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!

Link to comment
https://forums.phpfreaks.com/topic/121804-solved-annoying-mysql-error/
Share on other sites

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());
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.