检查用户是否存在于数据库中

时间:2014-03-16 19:38:03

标签: php mysql if-statement exists

我有一个问题,我不知道为什么不运行

$fb_id = $db->real_escape_string($fb_id);
        $result = $db->query("select id,fb_id from users where fb_id='$fb_id'");
        if (mysql_num_rows($result) > 0) {
            echo "user exist";
        } else {
echo "user dont exist";
        }

有一个错误

Warning: mysql_num_rows() expects parameter 1 to be resource, object given in 94

但在第94行我有

if (mysql_num_rows($result) > 0) {

感谢您的帮助

0 个答案:

没有答案
相关问题