Jump to content

[SOLVED] Add to MySQL


rascle

Recommended Posts

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.