mysql num satırlar başarısız oluyor

1 Cevap php
$result=mysql_query("SELECT * FROM users WHERE pass='".sha1($_POST['mainloginpass'])."'");

if(mysql_num_rows($result)==1){

o diyor ki "mysql_num_rows () parametre 1 kaynak olmasını beklediğini, boolean given"

1 Cevap

mysql_query normally returns a resource, but according to the docs:
mysql_query() will return FALSE on error and also fail and return FALSE if the user does not have permission to access the table(s) referenced by the query.

Böyle bir şey denemek isteyebilirsiniz:

if (!$result) {
    die('Invalid query: ' . mysql_error());
}

Sorunun ne olduğunu görmek için.