Jump to content

Simple MySql Query Not Working! Please Help


paulman888888

Recommended Posts

Hello;

I keep getting this error

MySql Error

Which is not really an error because it doesnt tell whats wrong.

 

Here's my code

$check=mysql_query("UPDATE chess_events SET delete='$delete' WHERE id='" . mysql_real_escape_string($id) . "' ")or die(mysql_error);

 

 

Please can you tell me what i have done wrong and why MySql Doesn't Give Me An Error!

 

Thankyou

Paul

your error checking is wrong...it should be:

$check=mysql_query("UPDATE chess_events SET delete='$delete' WHERE id='" . mysql_real_escape_string($id) . "' ")or die(mysql_error());

 

but the problem is with your field "delete". delete is a reserved word, and it's bad practice to use it as a field name. if you can, change it (maybe use 'removed' instead). if you can change it, use backticks to escape it:

$check=mysql_query("UPDATE chess_events SET `delete`='$delete' WHERE id='" . mysql_real_escape_string($id) . "' ")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.