introduce chksql function for phpscripts

Checks SQL query results for errors and bails out if it finds one.
Avoids some heavy code duplication all over the place.
This commit is contained in:
Sarah Hoffmann
2016-06-09 00:24:18 +02:00
parent 85c72cdccd
commit cf4a44aaf7
3 changed files with 51 additions and 105 deletions

View File

@@ -143,3 +143,13 @@
echo "\n";
exit;
}
function chksql($oSql, $sMsg = false)
{
if (PEAR::isError($oSql))
{
fail($sMsg || $oSql->getMessage(), $oSql->userinfo);
}
return $oSql;
}