CoreBOSBB
A good way to get feedback on database updates - Printable Version

+- CoreBOSBB (https://discussions.corebos.org)
+-- Forum: Development (https://discussions.corebos.org/forumdisplay.php?fid=18)
+--- Forum: coreBOS Development (https://discussions.corebos.org/forumdisplay.php?fid=4)
+--- Thread: A good way to get feedback on database updates (/showthread.php?tid=327)



A good way to get feedback on database updates - Guido1982 - 07-21-2016

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;