<td class="header2">Top 5 Games</td> </tr> <tr> <td class="content2"> <?php $minViews = 0; $count1 = 0; $newest2 = "SELECT name, views, ID FROM dd_games WHERE `active`='1' AND Views>$minViews ORDER BY Views DESC"; $newest1 = sqlcache('newest', $cachelife, $newest2); foreach($newest1 as $row1){ $newestname = preg_replace('#\W#', '-', $row1['name']); if($count1<=4){ echo '<ul class=\'catmenu\'> <li>'; if ($seo_on == 1){ echo "<a href='".$domain."/play/".$row1["ID"]."-".$newestname.".html'>" .$row1["name"]." - (" .$row1["views"].")</a>"; }else{ echo "<a href='".$domain."/index.php?action=play&ID=" .$row1["ID"]. "'>".$row1["name"]." - (" .$row1["views"].")</a>"; } echo '</li> </ul>';} $count1++; } echo '<br />'; if ($seo_on == 1){ echo ' <a href=\''.$domain.'/mostplayed/\' title=\'Most Played\'>View more >>></a>';}else{ echo ' <a href=\''.$domain.'/index.php?action=mostplayed\' title=\'Most Played\'>View more >>></a>';} ?> </td>
<tr> <td class="header2">Latest Games</td> </tr> <tr> <td class="content2"> <?php $count2 = 0; $latest2 = "SELECT name, dateadded, ID FROM dd_games WHERE `active`='1' ORDER BY dateadded DESC"; $latest1 = sqlcache('latest', $cachelife, $latest2); foreach($latest1 as $row2){ $latestname = preg_replace('#\W#', '-', $row2['name']); if($count2<=4){ echo '<ul class=\'catmenu\'> <li>'; if ($seo_on == 1){ echo "<a href='".$domain."/play/".$row2["ID"]."-".$latestname.".html'>" .$row2["name"]. "</a>"; }else{ echo "<a href='".$domain."/index.php?action=play&ID=" .$row2["ID"]. "'>" .$row2["name"]. "</a>"; } echo '</li> </ul>';} $count2++; } echo '<br />'; if ($seo_on == 1){ echo ' <a href=\''.$domain.'/newest/\' title=\'Newest\'>View more >>></a>';}else{ echo ' <a href=\''.$domain.'/index.php?action=newest\' title=\'Newest\'>View more >>></a>';} ?> </td> </tr>
echo ' <table width=\'100%\' border=\'0\'> <tr> <td class=\'header\'>Top 5 Games</td> </tr> <tr> <td class=\'content2\'>'; $minViews = 5; $queryt = "SELECT Name, Views, ID FROM dd_games WHERE Views>$minViews ORDER BY Views DESC"; $resultt = mysql_query($queryt); if (!$resultt) { //do something if nothing is returned from the db echo'An error occured'; }else{ if ($seo_on == 1){ echo '<div class=\'catmenu\'>'; for ($i=0; $i<5; $i++){ echo "<a href='".$domain."/play/".mysql_result($resultt, $i, "ID")."-".mysql_result($resultt, $i, "Name").".html'>" . mysql_result($resultt, $i, "Name") . " - (" . mysql_result($resultt, $i, "Views") . ") </a>";} echo '</div>'; echo '<br />'; echo '<a href=\''.$domain.'/mostplayed/\' title=\'Most Played\'>View more >>></a>'; }else{ echo '<div class=\'catmenu\'>'; for ($i=0; $i<5; $i++){ echo "<a href='".$domain."/index.php?action=play&ID=" . mysql_result($resultt, $i, "ID") . "'>" . mysql_result($resultt, $i, "Name") . " - (" . mysql_result($resultt, $i, "Views") . ") </a>";} echo '</div>'; echo '<br />'; echo '<a href=\''.$domain.'/index.php?action=mostplayed\' title=\'Most Played\'>View more >>></a>';}} echo '</td></tr></table>';
$count = 0;
<tr> <td class="header2">Latest Games</td> </tr> <tr> <td class="content2"> <?php $queryl = "SELECT Name, dateadded, ID FROM dd_games WHERE `active`='1' ORDER BY dateadded DESC"; $resultl = mysql_query($queryl); if (!$resultl) { //do something if nothing is returned from the db echo'An error occured'; }else{ if ($seo_on == 1){ echo '<ul class=\'catmenu\'>'; for ($i=0; $i<5; $i++){ echo "<li><a href='".$domain."/play/".mysql_result($resultl, $i, "ID")."-".mysql_result($resultl, $i, "Name").".html'>" . mysql_result($resultl, $i, "Name") . "</a></li>";} echo '</ul>'; echo '<br />'; echo ' <a href=\''.$domain.'/newest/\' title=\'Most Played\'>View more >>></a>'; }else{ echo '<ul class=\'catmenu\'>'; for ($i=0; $i<5; $i++){ echo "<li><a href='".$domain."/index.php?action=play&ID=" . mysql_result($resultl, $i, "ID") . "'>" . mysql_result($resultl, $i, "Name") . "</a></li>";} echo '</ul>'; echo '<br />'; echo ' <a href=\''.$domain.'/index.php?action=newest\' title=\'Newest\'>View more >>></a>';}} ?> </td> </tr>
Hi spagetiokiller I was wondering if you could help I have used your code on my site slightly changing it to fit in the centre rather than the sides but im not very good with php. My question is how do I add the image to the side of the game?Below is how the code currently looks I would like to add it to the top of each title if possible?http://jamsiteproject.comli.com/ - Example of what it currently looks likeCode: [Select] echo ' <table width=\'100%\' border=\'0\'> <tr> <td class=\'header\'>Top 5 Games</td> </tr> <tr> <td class=\'content2\'>'; $minViews = 5; $queryt = "SELECT Name, Views, ID FROM dd_games WHERE Views>$minViews ORDER BY Views DESC"; $resultt = mysql_query($queryt); if (!$resultt) { //do something if nothing is returned from the db echo'An error occured'; }else{ if ($seo_on == 1){ echo '<div class=\'catmenu\'>'; for ($i=0; $i<5; $i++){ echo "<a href='".$domain."/play/".mysql_result($resultt, $i, "ID")."-".mysql_result($resultt, $i, "Name").".html'>" . mysql_result($resultt, $i, "Name") . " - (" . mysql_result($resultt, $i, "Views") . ") </a>";} echo '</div>'; echo '<br />'; echo '<a href=\''.$domain.'/mostplayed/\' title=\'Most Played\'>View more >>></a>'; }else{ echo '<div class=\'catmenu\'>'; for ($i=0; $i<5; $i++){ echo "<a href='".$domain."/index.php?action=play&ID=" . mysql_result($resultt, $i, "ID") . "'>" . mysql_result($resultt, $i, "Name") . " - (" . mysql_result($resultt, $i, "Views") . ") </a>";} echo '</div>'; echo '<br />'; echo '<a href=\''.$domain.'/index.php?action=mostplayed\' title=\'Most Played\'>View more >>></a>';}} echo '</td></tr></table>';Thanks for any help
$minViews = 0; $count1 = 0; $newest2 = "SELECT * FROM dd_games WHERE `active`='1' AND Views>$minViews ORDER BY Views DESC"; $newest1 = sqlcache('newest', $cachelife, $newest2);echo'<table width=\'100%\' border=\'0\'> <tr> <td class=\'header\'>Top 5 games</td> </tr> <tr> <td>'; echo '<table width=\'100%\'>'; foreach($newest1 as $row1 ){ if($count1<=4){ $gamename = ereg_replace('[^A-Za-z0-9]', '-', $row1['name']); if($seo_on == 1){ $playlink = ''.$domain.'/play/'.$row1['ID'].'-'.$gamename.'.html'; }else{ $playlink = ''.$domain.'/index.php?action=play&ID='.$row1['ID'].''; } echo ' <tr> <td width=\'45\' height=\'45\' valign=\'top\' class=\'content\'> <a href=\''.$playlink.'\'> '; if($row1['type'] == 1){ echo ' <img src=\''.$domain.'/'.$thumbsfolder.'/'.$row1['thumb'].'\' width=\'45\' height=\'45\' alt= \'\' border=\'0\'/>'; }else{ echo ' <img src=\''.$row1['thumburl'].'\' width=\'45\' height=\'45\' alt= \'\' border=\'0\'/>'; } echo ' </a> </td> <td valign=\'top\' class=\'content\'><div class=\'gamehometitle\'><a href=\''.$playlink.'\'>'.$row1['name'].'</a></div> <div class=\'gamehomedesc\'>'.desclimit($row1['description']).' <a href=\''.$playlink.'\'>Play</a></div></td> </tr>'; }$count1++;}; echo '<tr><td colspan=\'2\' class=\'content\'>'; if ($seo_on == 1){echo ' <a href=\''.$domain.'/mostplayed/\' title=\'Most Played\'>View more top games</a>';}else{echo ' <a href=\''.$domain.'/index.php?action=mostplayed\' title=\'Most Played\'>View more top games</a>';}echo '</td> </tr> </table>';
sql query, its not &&.. its just AND
of course unless your mort, then you probably already did this and DIDNT TELL ME! lol