开发者

PHP error driving me crazy

开发者 https://www.devze.com 2023-01-04 12:40 出处:网络
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
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

精彩评论

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

关注公众号