Pi_Mastuh Posted December 15, 2006 Share Posted December 15, 2006 I'm running this query:$SQL = "UPDATE Mail SET read = '1' WHERE msgID = '$msgID'";$result2 = mysql_query($SQL, $connection);but nothing's happening. I try running the query on its own and substituing $msgID with an actualy number, but it says the query is wrong. Any ideas as to what's wrong? Link to comment https://forums.phpfreaks.com/topic/30701-whats-wrong/ Share on other sites More sharing options...
Psycho Posted December 15, 2006 Share Posted December 15, 2006 Try adding an error handler to see if anything useful is returned:$result2 = mysql_query($SQL, $connection) or die ("The query:<br>".$sql."<br>Caused the following error:<br>".mysql_error()); Link to comment https://forums.phpfreaks.com/topic/30701-whats-wrong/#findComment-141461 Share on other sites More sharing options...
JasonLewis Posted December 15, 2006 Share Posted December 15, 2006 have you got a table called mail with the field called read. and the number that your using, is that already in the table. if you are trying to insert then maybe you want INSERT INTO Mail... Link to comment https://forums.phpfreaks.com/topic/30701-whats-wrong/#findComment-141463 Share on other sites More sharing options...
TEENFRONT Posted December 15, 2006 Share Posted December 15, 2006 $result2 = mysql_query($SQL, $connection) or die ("The query:".$SQL."Caused the following error:".mysql_error());try that one instead - mjdamato had caps missing on the $SQL in the die() statement Link to comment https://forums.phpfreaks.com/topic/30701-whats-wrong/#findComment-141464 Share on other sites More sharing options...
Pi_Mastuh Posted December 15, 2006 Author Share Posted December 15, 2006 I'm running a query that when you load the page it changes Read from 0 to 1 if it's 0. And I got the following error:The query: UPDATE Mail SET read = '1' WHERE msgID = '1' Caused the following 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 'read = '1' WHERE msgID = '1'' at line 1 Link to comment https://forums.phpfreaks.com/topic/30701-whats-wrong/#findComment-141468 Share on other sites More sharing options...
TEENFRONT Posted December 15, 2006 Share Posted December 15, 2006 $SQL = "UPDATE `Mail` SET `read` = '1' WHERE `msgID` = '$msgID'";try that for your $SQL Link to comment https://forums.phpfreaks.com/topic/30701-whats-wrong/#findComment-141473 Share on other sites More sharing options...
Pi_Mastuh Posted December 15, 2006 Author Share Posted December 15, 2006 It works, thank you. Link to comment https://forums.phpfreaks.com/topic/30701-whats-wrong/#findComment-141476 Share on other sites More sharing options...
TEENFRONT Posted December 15, 2006 Share Posted December 15, 2006 no problem. Link to comment https://forums.phpfreaks.com/topic/30701-whats-wrong/#findComment-141478 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.