Having problems with and update query i keep getting
Warning: Crud::update() [crud.update]: Property access is not allowed yet in crud.php on line 60
This is my code
$stmt = $this->mysql->prepare('UPDATE links SET title = ?, url = ?, comment = ? WHERE id = ?');
$stmt->bind_param('sssi',$title,$url,$comment,$id);
$stmt->execute();
$stmt->close();
on line 60 return $stmt->affected_rows;
Googled it and only found one reference in the php documentation in a comment but i couldn't understand the comment :/
are you sure the stament returns true? this error occurs if the statement was not prepared properly, or not prepared at all, according to php documentation.
"To prevent this, always ensure that the return value of the "prepare" statement is true before accessing these properties."
Hope this helps
cheers
Do you want
$stmt->affected_rows();
vs.
$stmt->affected_rows;
?
I'm not sure.
Otherwise you can check to confirm that there was no mysql error first before checking the affected rows.
The problem was that i used $stmt->close(); before using $stmt->affected_rows; silly error really. thats what i get for late night coding.