Jump to content

[SOLVED] need help piecing this script together


2DaysAway

Recommended Posts

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>";
}
?>

$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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.