1

I have these mysql tables:


(players):

enter image description here

(environment_killers):

enter image description here

(killers):

enter image description here

(player_deaths):

enter image description here


And a PHP page that prints this result:

$timenow = time();  
$dayago = $timenow - (86400 * 1);

$monstrums= $SQL->query('SELECT * FROM z_monsters GROUP by name;');

$killers_monsters = mysql_query('
    SELECT COUNT(name) as liczba 
    FROM environment_killers,player_deaths,killers 
    where player_deaths.id = killers.death_id 
        and killers.id = environment_killers.kill_id 
        and name LIKE "%'.$monstrums[name].'" 
        and date > '.$dayago.';');

I need this PHP page to print the $killers_monsters result where player_deaths.player_id = players.id and players.world_id = '.$world_id.'

tshepang
  • 12,111
  • 21
  • 91
  • 136
user3050478
  • 272
  • 3
  • 19

1 Answers1

0

Let me guess, this is an open Tibia server? XD

Anyway, here you go (assuming your query is correct):

if($killers_monsters == true) {
    if(mysql_num_rows($killers_monsters) > 0) {
        while($row = mysql_fetch_object($killers_monsters)) {
            echo "Total count: " . $row->liczba . "<br />";
        }
    } else {
        echo "Total count: 0.<br />";
    }
} else {
    echo "An error occured! Total count: 0.<br />";
}
Steini
  • 2,753
  • 15
  • 24
  • yes, it is! xD. Hey, I didn't really understand what your script does... but I guess you got me wrong ^^. I wanna get the results from $killers_monsters where world_id = '.$world_id.' – user3050478 Jan 09 '14 at 07:53