rascle Posted January 19, 2009 Share Posted January 19, 2009 Hi i am using this code: <!-- Recently Played Games Code --> <?php if($logged[id]){ $domain = $_SERVER['HTTP_HOST']; $path = $_SERVER['SCRIPT_NAME']; $queryString = $_SERVER['QUERY_STRING']; $url = "http://" . $domain . $path . "?" . $queryString; $name="test"; $playedgames = mysql_query("UPDATE members SET recentgames = '<a href=\"$url\">$name</a><br />' WHERE '$logged[username]' = `username` ");} ?> <!--End of Tag --> But instead of changing the mysql db so that the field recentgames just says "<a href="rasclerhys.com">Test</a><br />" i want it to get the previous results and add them with the new results to the db. How would i do this?? Thanks Link to comment https://forums.phpfreaks.com/topic/141467-solved-add-to-mysql/ Share on other sites More sharing options...
rhodesa Posted January 19, 2009 Share Posted January 19, 2009 do you mean you want to APPEND to the recentgames field instead of setting it to something new? try this: $playedgames = mysql_query("UPDATE members SET recentgames = CONCAT(recentgames, '<a href=\"$url\">$name</a><br />') WHERE '$logged[username]' = `username` ");} Link to comment https://forums.phpfreaks.com/topic/141467-solved-add-to-mysql/#findComment-740492 Share on other sites More sharing options...
rascle Posted January 19, 2009 Author Share Posted January 19, 2009 Thanks for your suggestion. I tried it out but it did not update the mysql db even though the mysql info is correct. Link to comment https://forums.phpfreaks.com/topic/141467-solved-add-to-mysql/#findComment-740525 Share on other sites More sharing options...
rhodesa Posted January 19, 2009 Share Posted January 19, 2009 what about: $playedgames = mysql_query("UPDATE members SET recentgames = CONCAT(recentgames, '<a href=\"$url\">$name</a><br />') WHERE '$logged[username]' = `username` ") or die(mysql_error());} Link to comment https://forums.phpfreaks.com/topic/141467-solved-add-to-mysql/#findComment-740538 Share on other sites More sharing options...
rascle Posted January 19, 2009 Author Share Posted January 19, 2009 Thanks Link to comment https://forums.phpfreaks.com/topic/141467-solved-add-to-mysql/#findComment-740557 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.