TheFilmGod Posted March 19, 2007 Share Posted March 19, 2007 I'm trying to grab the value count from mysql and add one to it. This is very simple, but I"m still completely lost! here is the code: require("connect.php"); $result = mysql_query("SELECT fav_count FROM favs WHERE page_id = $page"); $result++; mysql_query("UPDATE favs SET fav_count = $result WHERE page_id = $page"); echo "Thank you for telling us you like this!<br />Please wait..."; echo "<META HTTP-EQUIV=Refresh CONTENT=\"2; URL=link.php\">"; Any help is greatly appreciated! Link to comment https://forums.phpfreaks.com/topic/43307-mysql-update/ Share on other sites More sharing options...
Yesideez Posted March 19, 2007 Share Posted March 19, 2007 Try this: <?php mysql_query("UPDATE favs SET `fav_count`=`fav_count`+1 WHERE `page_id`='".$page."'"); ?> Link to comment https://forums.phpfreaks.com/topic/43307-mysql-update/#findComment-210259 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.