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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.