*

Recent

Author Topic: add to favorites doesn't work right  (Read 11904 times)

ingrid

  • Newbie
  • *
  • Posts: 3
  • Force: +0/-0
add to favorites doesn't work right
« on: October 22, 2009, 01:05:00 PM »
I have a problem with "add tot favorites". Ik can add only one favorite. When I want tot add a second favorite, I get the message that the favorite has been put in my favorites, but it is not placed in my favorites.

How can I solve this problem.

kurt

  • Developer
  • Hero Member
  • ******
  • Posts: 634
  • Force: +16/-1
Re: add to favorites doesn't work right
« Reply #1 on: October 22, 2009, 04:28:56 PM »
Mmmmmm I see what you mean. There is a basic flaw in the process of how the script determins what to display when bringing up a list of favorites. I will see if I can work the flaw out and post in a bit later.

kurt

  • Developer
  • Hero Member
  • ******
  • Posts: 634
  • Force: +16/-1
Re: add to favorites doesn't work right
« Reply #2 on: October 23, 2009, 01:23:17 AM »
I'm pretty much stuck not being able to test it right now, but I have edited the code to /pages/myaccount/php to something that I think should work.

Save a copy of the unedited file first, in case this does not work. Open it up and find the function favorites() and replace that code with this

Code: [Select]


function favorites(){
global $domain, $db, $usrdata, $thumbsfolder, $gamesfolder, $seo_on;
echo '<h2>My Favorites</h2>';
$ro = $db->fetch_row($db->query(sprintf('SELECT * FROM dd_user_favorites WHERE userid=\''.$usrdata['userid'].'\'')));

echo '<table width=\'100%\' border=\'0\'>';
while($in = $db->fetch_row($ro)){
$r = $db->query(sprintf('SELECT * FROM dd_games WHERE ID=\'%u\'', $in['gameid']));
$gamename = ereg_replace('[^A-Za-z0-9]', '', $r['name']);
if($seo_on == 1){
$playlink = ''.$domain.'/play/'.$r['ID'].'-'.$gamename.'.html';
}else{
$playlink = ''.$domain.'/index.php?action=play&amp;ID='.$r['ID'].'';
}
       echo '
      <tr>
      <td valign=\'top\' colspan=\'2\' class=\'header\'><b>'.$r['name'].'</b></td>
      </tr>
      <tr>
      <td width=\'55\' height=\'55\' valign=\'top\' class=\'content\'>
      <a href=\''.$playlink.'\'>
      ';
      if($in['type'] == 1){
      echo ' <img src=\''.$domain.'/'.$thumbsfolder.'/'.$r['thumb'].'\' width=\'55\' width=\'55\' border=\'0\'>';
      }else{
      echo ' <img src=\''.$r['thumburl'].'\' width=\'55\' width=\'55\' border=\'0\'>';
      }
     
      echo ' </a>
      </td>
      <td valign=\'top\' class=\'content\'>'.browsedesclimit($r['description']).'
      <a href=\''.$playlink.'\' class=\'playlink\'><b>Play</b></a></td>
      </tr>';
}
echo '</table>';
echo '&nbsp;';
}





Let me know how it works. If it don't, I will try getting a chance to re edit and testing it tomorrow. Sorry bout that, I need better computer equipment :p

kurt

  • Developer
  • Hero Member
  • ******
  • Posts: 634
  • Force: +16/-1
Re: add to favorites doesn't work right
« Reply #3 on: October 23, 2009, 05:26:34 PM »
Hmmmmm that one didn't work. In fact, I think it crashed the server lol. Don't try it. I'll see if I can't re work it so that it does though. Sorr bout the delay.

kurt

  • Developer
  • Hero Member
  • ******
  • Posts: 634
  • Force: +16/-1
Re: add to favorites doesn't work right
« Reply #4 on: October 23, 2009, 10:28:59 PM »
Alrighty then, lets try this again shall we?

In /pages/myaccount.php replace the function favorites() with this code

Code: [Select]


function favorites(){
global $domain, $db, $usrdata, $thumbsfolder, $gamesfolder, $seo_on;
echo '<h2>My Favorites</h2>';
$ro = $db->query(sprintf('SELECT * FROM dd_user_favorites WHERE userid=\''.$usrdata['userid'].'\''));
echo '<table width=\'100%\' border=\'0\'>';
while($r = $db->fetch_row($ro)){
$in1 = $db->query(sprintf('SELECT * FROM dd_games WHERE ID=\'%u\'', $r['gameid']));
$in = $db->fetch_row($in1);

$gamename = ereg_replace('[^A-Za-z0-9]', '', $in['name']);
if($seo_on == 1){
$playlink = ''.$domain.'/play/'.$in['ID'].'-'.$gamename.'.html';
}else{
$playlink = ''.$domain.'/index.php?action=play&amp;ID='.$in['ID'].'';
}
       echo '
      <tr>
      <td valign=\'top\' colspan=\'2\' class=\'header\'><b>'.$in['name'].'</b></td>
      </tr>
      <tr>
      <td width=\'55\' height=\'55\' valign=\'top\' class=\'content\'>
      <a href=\''.$playlink.'\'>
      ';
      if($in['type'] == 1){
      echo ' <img src=\''.$domain.'/'.$thumbsfolder.'/'.$in['thumb'].'\' width=\'55\' width=\'55\' border=\'0\'>';
      }else{
      echo ' <img src=\''.$in['thumburl'].'\' width=\'55\' width=\'55\' border=\'0\'>';
      }
     
      echo ' </a>
      </td>
      <td valign=\'top\' class=\'content\'>'.browsedesclimit($in['description']).'
      <a href=\''.$playlink.'\' class=\'playlink\'><b>Play</b></a></td>
      </tr>';
}
echo '</table>';
echo '&nbsp;';
}





Let me know how that works and if it is more to your liking. Sorry, could not play with it too long right now, swamped. I did test it a little though.

Sorry too so long.