hey folks.............. need some help with some PHP script. I think it is quite simple but am a beginner in this field. Any help would be appreciated. I have a games arcade site. I want to display the most popular games at the top of the page using thumbnails stored in an images folder. The thumbnails have the exact same name as the actual game title with the extension ".png" I currently have this code which displays a text link showing the title of the most popular games. <? ## # AV ARCADE v3 # popular.php # Loads the most popular games/media module ## $sql = mysql_query("SELECT * FROM ava_games WHERE published=1 ORDER BY hits desc LIMIT 10"); while($row = mysql_fetch_array($sql)) { $abcd= $row['name']; $abcd = str_replace (" ", "-", $abcd); if ($seo_on == 0) { $url = 'index.php?task=view&id='.$row['id'].''; } else { $url = 'view/'.$row['id'].'/'.$abcd.'.htm'; } echo ' <a href="'.$site_url.'/'.$url.'">'.$row['name'].'</a><br>'; } ?> Code (markup): I would guess that the code will have to access the SQL DB to find the title of the most played games and then go into the images folder and load the thumbnail of the same name with the file extension ".PNG" Any help would be appreciated. Thanks
I'll assume your php file is running in public_html. Put the images into public_html/images and try this modified line where the text link was created... echo ' <a href="'.$site_url.'/'.$url.'"><img src="images/' . $url . '.png" border="0"></a><br>'; PHP: