function select($cmd) { $rtn = null; do_pg_connect(); debug("\nSQL: {$cmd}\n"); if (!($result = pg_query($cmd))) { $out = "\nSQL QUERY: " . $cmd . "\nSQL ERROR: " . pg_last_error() . "\nSQL ERROR: " . pg_result_error(); mtt_error($out); mtt_send_mail($out); } $rtn = pg_fetch_all($result); if (false == $rtn) { return array(); } else { return $rtn; } }
function associative_select($cmd) { $error_function = "associative_select()"; do_pg_connect(); debug("\nSQL: {$cmd}\n"); if (!($result = pg_query($cmd))) { $out = "\nSQL QUERY: " . $cmd . "\nSQL ERROR: " . pg_last_error() . "\nSQL ERROR: " . pg_result_error(); mtt_send_mail($out, $error_function); mtt_error($out); } return pg_fetch_array($result); }