MDanz Posted September 18, 2009 Share Posted September 18, 2009 <?php mysql_connect("localhost", "Master", "password"); mysql_select_db("db"); $id = $_GET['id']; $id = mysql_real_escape_string($id)or die (mysql_error()); ## always do this!!!! $check = mysql_query("SELECT * FROM Stacks WHERE id='$id'"); $checknum = mysql_num_rows($check); if ($checknum==1) { //run a query to activate the account $query = mysql_query("UPDATE Stacks SET reportposted ='NOW()' WHERE id='$id'") or die (mysql_error()); } else{ echo "<font color=white>Invalid ID</font>"; } ?> i want it to update the row field 'reportposted' with the current time.. but its not working... everytime i check in mysql its 0000-00-00 00:00:00 Link to comment https://forums.phpfreaks.com/topic/174705-solved-query-problem/ Share on other sites More sharing options...
PFMaBiSmAd Posted September 18, 2009 Share Posted September 18, 2009 You already have a thread where the answer was given - Strings have single-quotes around them. NOW() is not a string, it is a mysql function. Remove the single-quotes from around it. Link to comment https://forums.phpfreaks.com/topic/174705-solved-query-problem/#findComment-920719 Share on other sites More sharing options...
MDanz Posted September 18, 2009 Author Share Posted September 18, 2009 oh yeah lol thx Link to comment https://forums.phpfreaks.com/topic/174705-solved-query-problem/#findComment-920721 Share on other sites More sharing options...
PFMaBiSmAd Posted September 18, 2009 Share Posted September 18, 2009 Programming has a great amount of symmetry, consistency, and continuity. Something that worked before, will work the same way in the same situation for the same reason. Link to comment https://forums.phpfreaks.com/topic/174705-solved-query-problem/#findComment-920725 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.