开发者

PHP error driving me crazy

Fatal error: Call to undefined method CI_DB_mysql_driver::num_rows() in C:\Development\Zend\Apache2\htdocs\system\application\controllers\signup.php on line 47

Can anyone help me out, this error is driving me crazy. Using latest CodeIgniter.

        function开发者_高级运维 isUniqueUsername($string) {
        $query = $this->db->select('username')
                ->from('olm_user')
                ->where('username', $string);
        if ($query->num_rows()) {
            return false;
        } else {
            return true;
        }
    }


You're missing a ->get() :)

$query = $this->db->select('username')
        ->from('olm_user')
        ->where('username', $string)
        ->get();

The query is executed and the result object is returned after a call to get(). Then you can call on that object num_rows() or other methods.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜