global $db;
- $rs = $db->Execute($sql);
- if (empty($rs)) return false;
+ if (!$rs = $db->Execute($sql)) {
+ if ($CFG->debug > 7) {
+ notify($db->ErrorMsg()."<br /><br />$sql");
+ }
+ return false;
+ }
if ( $rs->RecordCount() ) {
return true;
global $db;
$rs = $db->Execute("$sql");
- if (empty($rs)) return 0;
+ if (!$rs) {
+ if ($CFG->debug > 7) {
+ notify($db->ErrorMsg()."<br /><br />$sql");
+ }
+ return 0;
+ }
return $rs->fields[0];
}
if (!$rs = $db->Execute("$sql$limit")) {
if ($CFG->debug > 7) { // Debugging mode - print checks
- $db->debug=true;
- $db->Execute("$sql$limit");
- $db->debug=false;
+ notify( $db->ErrorMsg() . "<br /><br />$sql$limit" );
}
return false;
}
*/
function get_records_sql($sql) {
- global $db;
+ global $CFG,$db;
- $rs = $db->Execute("$sql");
- if (empty($rs)) return false;
+ if (!$rs = $db->Execute($sql)) {
+ if ($CFG->debug > 7) {
+ notify($db->ErrorMsg()."<br /><br />$sql");
+ }
+ return false;
+ }
if ( $rs->RecordCount() > 0 ) {
if ($records = $rs->GetAssoc(true)) {
global $db;
- $rs = $db->Execute("$sql");
- if (empty($rs)) return false;
+ if (!$rs = $db->Execute($sql)) {
+ if ($CFG->debug > 7) {
+ notify($db->ErrorMsg()."<br /><br />$sql");
+ }
+ return false;
+ }
if ( $rs->RecordCount() > 0 ) {
while (!$rs->EOF) {
}
$rs = $db->Execute("SELECT $return FROM $CFG->prefix$table $select");
- if (empty($rs)) return false;
+ if (!$rs) {
+ if ($CFG->debug > 7) {
+ notify($db->ErrorMsg()."<br /><br />SELECT $return FROM $CFG->prefix$table $select");
+ }
+ return false;
+ }
if ( $rs->RecordCount() == 1 ) {
return $rs->fields["$return"];
/// Run the SQL statement
if (!$rs = $db->Execute($insertSQL)) {
+ if ($CFG->debug > 7) {
+ notify($db->ErrorMsg()."<br /><br />$insertSQL");
+ }
return false;
}
if ($rs = $db->Execute("UPDATE $CFG->prefix$table SET $update WHERE id = '$dataobject->id'")) {
return true;
} else {
+ if ($CFG->debug > 7) {
+ notify($db->ErrorMsg()."<br /><br />UPDATE $CFG->prefix$table SET $update WHERE id = '$dataobject->id'");
+ }
return false;
}
}