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

Link to comment
Share on other sites

$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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.