Eroare: member function fetch_array() on bool

Discutii despre script-uri si coduri PHP-MySQL, precum si lucru cu XML in PHP.
royal27
Mesaje: 66

Eroare: member function fetch_array() on bool

Am creat sintaxa asta in home php
Cand este setat 1 in baza de date la userul respectiv ar trebui sa imi arate true iar cand e 0 sa imi arate false.

Cod: Selectaţi tot

$admn =$xyz->query("SELECT lock FROM sh99x_users WHERE name='".$nick."'")->fetch_array();
if($admn[0]=='1')
{
echo "true";
}else{
echo "false";
}

Dar mie imi arata eroarea asta

Cod: Selectaţi tot

Fatal error: Uncaught Error: Call to a member function fetch_array() on bool in /home4/bzplekzb/legacy-cms.ro/system/home/home.php:33 Stack trace: #0 /home4/bzplekzb/legacy-cms.ro/system/site/page.php(32): include() #1 /home4/bzplekzb/legacy-cms.ro/index.php(25): require('/home4/bzplekzb...') #2 {main} thrown in /home4/bzplekzb/legacy-cms.ro/system/home/home.php on line 33

MarPlo
Incearca asa:

Cod: Selectaţi tot

$res = $xyz->query("SELECT lock FROM sh99x_users WHERE name='".$nick."'");

if($res->num_rows >0){
  $row = $res->fetch_array();

  if($row[0]==1) echo 'True';
  else echo 'False';
}
else {
  echo '0 rezultate';
}

royal27
Era o problema unde nu trebuia adaugat acel cod, am rezolvat ,mersi

Subiecte similare