Ir para conteúdo

Erro function fetch() no characters.php


Rajas

Posts Recomendados

 

$bgcolor = (($number_of_rows++ % 2 == 1) ?  $config['site']['darkborder'] : $config['site']['lightborder']);$v = $SQL->query("SELECT (SELECT COUNT(`death_id`) FROM `killers` k LEFT JOIN `player_killers` pk ON `k`.`id` = `pk`.`kill_id` LEFT JOIN `players` p ON `pk`.`player_id` = `p`.`id` WHERE `k`.`unjustified` >= 0 AND `player_id` = '" . $player->getID() . "'), COUNT(`player_id`) FROM `player_deaths` WHERE `player_id` = '".$player->getID()."'")->fetch();$main_content .= '<tr bgcolor='.$bgcolor.'><td>Kills and Deaths:</td><td>' . htmlspecialchars($v[0]) . ' kills and ' . htmlspecialchars($v[1]) . ' deaths</td></tr>';   [/PHP]

 

essa parte eu gostaria de adicionar no characters.php porem esta dando o seguinte erro:

Fatal error: Call to a member function fetch() on a non-object in D:\xampp\htdocs\victorfasano\pages\characters.php on line 87


que a linha abaixo:            

 

 

  $v = $SQL->query("SELECT (SELECT COUNT(`death_id`) FROM `killers` k LEFT JOIN `player_killers` pk ON `k`.`id` = `pk`.`kill_id` LEFT JOIN `players` p ON `pk`.`player_id` = `p`.`id` WHERE `k`.`unjustified` >= 0 AND `player_id` = '" . $player->getID() . "'), COUNT(`player_id`) FROM `player_deaths` WHERE `player_id` = '".$player->getID()."'")->fetch(); [/SQL]	 

No script original era assim:

$v = $SQL->query('SELECT (SELECT COUNT(`death_id`) FROM `killers` k LEFT JOIN `player_killers` pk ON `k`.`id` = `pk`.`kill_id` LEFT JOIN `players` p ON `pk`.`player_id` = `p`.`id` WHERE `k`.`unjustified` >= 0 AND `player_id` = ' . $player->getID() . '), COUNT(`player_id`) FROM `player_deaths` WHERE `player_id` = '.$player->getID())->fetch();$bgcolor = (($number_of_rows++ % 2 == 1) ?  $config['site']['darkborder'] : $config['site']['lightborder']);$main_content .= '<tr bgcolor='.$bgcolor.'><td>Kills and Deaths:</td><td>' . htmlspecialchars($v[0]) . ' kills and ' . htmlspecialchars($v[1]) . ' deaths</td></tr>';

 

 

Desde de já agradeço pela atenção!

Editado por falaaa
Inserir CODE
Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...