Today's Posts Follow Us On Twitter! TFL Members on Twitter  
Forum search: Advanced Search  
Navigation
Marketplace
  Members Login:
Lost password?
  Forum Statistics:
Forum Members: 24,254
Total Threads: 80,792
Total Posts: 566,472
There are 1322 users currently browsing (tf).
 
  Our Partners:
 
  TalkFreelance     Design and Development     Programming     PHP and MySQL :

PHP Arcade Script Help

Thread title: PHP Arcade Script Help
     
    Thread tools Search this thread Display Modes  
Prev Previous Post   Next Post Next
11-03-2007, 10:14 AM
#1
Jmz is offline Jmz
Status: Member
Join date: Jun 2007
Location: Newcastle, UK
Expertise:
Software:
 
Posts: 245
iTrader: 7 / 100%
 

Jmz is on a distinguished road

Send a message via MSN to Jmz

  Old  PHP Arcade Script Help

Hi, I'm skinning PHPas but I want to change how the games are displayed on the front page. I'm trying to display the four top rated games in the database. My code looks like:

Code:
<?

  					  $x = 0;
  					  $gamelist = "";
  					  $maingame = "";
              $sql_query2 = "SELECT * FROM games where gamestatus = 1 ORDER BY rating ASC LIMIT 4";
  				    $result2 = mysql_query($sql_query2);
  				    if(mysql_num_rows($result2))
  				    {
  				    															
  					  // Gets all the game information if available
  				  	while($row = mysql_fetch_array($result2))
  				    {
  				     $x++;
               $gameid = $row['gameid'];
  		    		 $gametitle = stripslashes($row['gametitle']);
  		   			 $gamedesc = stripslashes($row['gamedesc']);
  		   			 $gamekeywords = $row['gamekeywords'];
   			       $gamefile = $row['gamefile'];
  		  		   $gameheight = $row['gameheight'];
  					   $gamewidth = $row['gamewidth'];
  		 			   $category = $row['category'];
  					   $timesplayed = $row['timesplayed'];
  					   $rating = $row['rating'];
  					   $gameicon = $row['gameicon'];
  					   $gamelocation = $row['gamelocation'];
  					   $iconlocation = $row['iconlocation'];
  					   
  					  
              // Limit the # of characters in the Game Description
              if (strlen($gamedesc)> 35)
              $gamedesc = substr($gamedesc,0,35)." ...";
              
              $title = make_friendly($gametitle);
              
              if ($iconlocation == 1)
              $gameicon = $gameicon;
              elseif (!empty($gameicon))
              $gameicon = $base_url."games/images/".$gameicon;
              
                if (empty($gameicon))
                $gameicon = $defaulticon;
              
              if ($rewrite ==0)
              $gamelink = $base_url."index.php?action=playgame&gameid=".$gameid;
              else
              $gamelink = $base_url.$sedir."/".$gameid."/".$title;
              
              
              $maingame = "<div class=\"game_listing\"><a href=\"$gamelink\"><img src=\"$gameicon\" alt=\"$gametitle icon\" class=\"game_img\"/></a><a href=\"$gamelink\">$gametitle</a><p class=\"game_desc\">$gamedesc</p><p class=\"clear\"></p></div>";

          
              }		}			   
      
      

	
        $content = $content."<div class=\"contentheader\">
			<p class=\"top_rated\">
            Top Rated Games
            </p>
        </div>
        <div class=\"contentarea_right\">$maingame<p class=\"clear\"></p>
        </div>";
      
              
   

      

?>

          <?=$content;?>

It seems to be working apart from it only shows one game (the one with the highest rating) instead of four.

Any ideas where I'm going wrong?

     


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

  Posting Rules  
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump:
 
  Contains New Posts Forum Contains New Posts   Contains No New Posts Forum Contains No New Posts   A Closed Forum Forum is Closed