2DaysAway Posted January 31, 2008 Share Posted January 31, 2008 Ok, what I want to do is search the DB for the player with the largest kills which I did. Now what i want it to do is place an image next to the players name. "If player has the max killed then echo the image" How would I write that quote out in php? This is what i got so far <?php $query = "SELECT pimp,hoeskilled FROM `{$tab[pimp]}` WHERE `rid`=$rid"; $get = mysql_query($query); if (!$get) { $message = 'Invalid query: ' . mysql_error() . "\n"; $message .= 'Whole query: ' . $query; die($message); } while ($get = mysql_fetch_array($hk)){ $mhk = max($hk); echo "<a href=\"\"onMouseover=\"popup('<span class=styleGreen>Hoe Killer</span><br/>')\"; onMouseout=\"\kill()\"><img src='images/50.png' width='16' height='16' alt='killer award' border='0'></a>"; } ?> Link to comment https://forums.phpfreaks.com/topic/88765-solved-need-help-piecing-this-script-together/ Share on other sites More sharing options...
uwannadonkey Posted January 31, 2008 Share Posted January 31, 2008 sry to ask, but first thing first. was $hk ever set? Link to comment https://forums.phpfreaks.com/topic/88765-solved-need-help-piecing-this-script-together/#findComment-454745 Share on other sites More sharing options...
2DaysAway Posted February 1, 2008 Author Share Posted February 1, 2008 This is all i have for $hk, so no its not set. Should i put something like $hk = ""; Link to comment https://forums.phpfreaks.com/topic/88765-solved-need-help-piecing-this-script-together/#findComment-455211 Share on other sites More sharing options...
laffin Posted February 1, 2008 Share Posted February 1, 2008 $hk shud be $get. the query itself could be written as $query = "SELECT pimp,hoeskilled FROM `{$tab[pimp]}` WHERE `rid`=$rid ORDER BY hoeskilled DESC"; since now ya got # of hoes killed in a descending order, all u need is the first row. you can add images to the html like $tcount=1; while ($row = mysql_fetch_assoc($get)){ $image=(($tcount<=10) ? $tcount:"default") . ".png"; echo "<a href=\"\"onMouseover=\"popup('<span class=styleGreen>Hoe Killer</span><br/>')\"; onMouseout=\"\kill()\"><img src='images/$image' width='16' height='16' alt='killer award' border='0'></a>"; } now all u need are the top10 png images, and a default images. top1.gif - top10.gif Link to comment https://forums.phpfreaks.com/topic/88765-solved-need-help-piecing-this-script-together/#findComment-455260 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.