Jump to content
php.lv forumi

Neiet ne array, ne num_rows..


false

Recommended Posts

Nezinu kas notiek, bet jebkadā kodā rada eroru:

 

Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\xampp\xampp\htdocs\index.php on line 271

$viesi = mysql_num_rows(mysql_query("SELECT * FROM lietotaaji WHERE id = '0' and time >= ".$delays.""));

 

Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\xampp\xampp\htdocs\index.php on line 252

$entity = mysql_fetch_array(mysql_query("SELECT * FROM lietotaaji WHERE id={$_SESSION['id']}"), MYSQL_ASSOC);

 

Kāda vaina?

Link to comment
Share on other sites

Tavā SQL kvērijā.

 

Nemočkā visu vienā rindā - dari visu lēnām un mierīgi:

$sql = "SELECT * FROM users";
$result = mysql_query($sql) or die(mysql_error()); //pie šīs rindiņas tev viss noteikti apstāsies, jo būs kļūda kvērijā
while($user = mysql_fetch_assoc($result) {
 echo $user["id"];
}

 

Vaina ir tur, ka tavs kvērijs ir ar kļūdām. mysql_query() atgriež FALSE, ja neizdodas izpildīt tavu padoto kvēriju. Uz to arī vajag pārbaudīt.

Link to comment
Share on other sites

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.   Paste as plain text instead

  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.

Loading...
×
×
  • Create New...