views:

55

answers:

1
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;
        }
    }
+2  A: 

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.

Bogdan
Thanks, problem solved!
Dr Hydralisk