[eluser]kyleect[/eluser]
EDIT:
The query is run and the data is inserted even with the error. I get the same error when I try to run num_rows()
--
I'm trying to call affected_rows() in my model and I'm getting an error when I do. See below for the code and error. Note: both $this->data and $this->query are properties of the model
Code:
public function register($data)
{
$this->data['email'] = $data['email_address'];
$this->data['username'] = $data['username'];
$this->data['password'] = md5($data['password']);
$this->query = $this->db->query("
INSERT INTO `users`
(`email`, `username`, `password`)
VALUES
('{$this->data['email']}', '{$this->data['username']}', '{$this->data['password']}')
");
if($this->query->affected_rows() > 0)
{
return true;
}
else
{
return false;
}
}
Quote:Fatal error: Call to a member function affected_rows() on a non-object in /application/models/Users.php on line 45