CoreBOSBB

Full Version: A good way to get feedback on database updates
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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:

PHP Code:
$result $this->db->pquery($query$params);
if (
$this->db->getAffectedRowCount($result) >= 1) {
   return 
true;
} else {
  return 
false;