The "mysql_db_query()" and "mysql_query()" functions only return false (0)
when you have an error in your query or parameter definition, otherwise they
always return a positive result identifier. So, if you must know if is there
any valid record you should ask for the row number returned :
// Check if a valid result has records
if(mysql_num_rows($result) > 0){
    // stuff
}
else{
    // No records procedure
}

HTH

Jayme.

http://www.conex.com.br/jjeffman



-----Mensagem Original-----
De: Kevin Connolly <[EMAIL PROTECTED]>
Para: <[EMAIL PROTECTED]>
Enviada em: sexta-feira, 26 de janeiro de 2001 15:37
Assunto: [PHP-DB] $result = true or false??


Hi,
    $db = mysql_connect("localhost", "root");
    mysql_select_db("mydb",$db);
    $sql = "SELECT * FROM employees where first = '$login'";
    $result = mysql_db_query ("mydb", $sql);
    echo "$result";

If I run this cose then $result always = Resource id #2 even if $login is
not a member of the database.
Is there anyway I can get it to output true if $login is a member and false
if $login is not a member? or at least get $result to be different if $login
is in the database to that when it is not?

Thanks,

Kevin.



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to