monkeypaw201 Posted February 19, 2008 Share Posted February 19, 2008 Here is the code: <?php $con = mysql_connect("localhost","user","pass"); if (!$con) { die('Could not connect: ' . mysql_error()); }mysql_select_db("database", $con); mysql_query("UPDATE private_messages SET read = 'Yes' WHERE id = '$_GET[id]'");mysql_close($con); ?> Its not working... no errors, the page loads fine, it just doesnt update Link to comment https://forums.phpfreaks.com/topic/91972-help-with-update/ Share on other sites More sharing options...
revraz Posted February 19, 2008 Share Posted February 19, 2008 Put the query in a string, echo the query to make sure it is reading your id, and use mysql_error() after your query to see if there are any errors. Link to comment https://forums.phpfreaks.com/topic/91972-help-with-update/#findComment-471065 Share on other sites More sharing options...
monkeypaw201 Posted February 19, 2008 Author Share Posted February 19, 2008 Put the query in a string, echo the query to make sure it is reading your id, and use mysql_error() after your query to see if there are any errors. Query in string outputs: UPDATE private_messages SET read = 'Yes' WHERE id = '1' mysql_error after query outputs: (nothing) Soooo Lost... Link to comment https://forums.phpfreaks.com/topic/91972-help-with-update/#findComment-471071 Share on other sites More sharing options...
monkeypaw201 Posted February 19, 2008 Author Share Posted February 19, 2008 can anyone help? Link to comment https://forums.phpfreaks.com/topic/91972-help-with-update/#findComment-471096 Share on other sites More sharing options...
revraz Posted February 19, 2008 Share Posted February 19, 2008 Remove the single quotes around 1 and see if it works. Link to comment https://forums.phpfreaks.com/topic/91972-help-with-update/#findComment-471099 Share on other sites More sharing options...
monkeypaw201 Posted February 19, 2008 Author Share Posted February 19, 2008 did help... i'm pretty much clueless on whats wrong.. Link to comment https://forums.phpfreaks.com/topic/91972-help-with-update/#findComment-471104 Share on other sites More sharing options...
monkeypaw201 Posted February 19, 2008 Author Share Posted February 19, 2008 UPDATE:: Typo on post above, DIDN'T HELP... Anyone? ??? Link to comment https://forums.phpfreaks.com/topic/91972-help-with-update/#findComment-471122 Share on other sites More sharing options...
Coreye Posted February 19, 2008 Share Posted February 19, 2008 Try: <?php $con = mysql_connect("localhost","user","pass"); if (!$con) { die('Could not connect: ' . mysql_error()); }mysql_select_db("database", $con); mysql_query("UPDATE `private_messages` SET `read`='Yes' WHERE `id`='" . $_GET['id'] . "')or die(mysql_error()); mysql_close($con); ?> Link to comment https://forums.phpfreaks.com/topic/91972-help-with-update/#findComment-471191 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.