07-21-2016, 04:50 PM
I didn't know about this until I was searching for it in Peardatabase.php:
When you do an UPDATE query and you want to find out if all went well, you can use the 'getAffectedRowCount' method of the '$adb' object. This will give you the number of affected rows which will tell you if at least one row was affected. Use your query result object as a parameter:
When you do an UPDATE query and you want to find out if all went well, you can use the 'getAffectedRowCount' method of the '$adb' object. This will give you the number of affected rows which will tell you if at least one row was affected. Use your query result object as a parameter:
PHP Code:
$result = $this->db->pquery($query, $params);
if ($this->db->getAffectedRowCount($result) >= 1) {
return true;
} else {
return false;
}