/** * The main query function. Runs the SQL on the connection and handles errors. * @param string $sql sql code * @param bool $errorstop set to false to supress the error message * @return results of the sql statements * @since 0.6 */ function query($sql, $errorstop = true) { global $_zp_DB_connection, $_zp_DB_details; if ($_zp_DB_connection) { if ($result = @mysql_query($sql, $_zp_DB_connection)) { return $result; } } if ($errorstop) { dbErrorReport($sql); } return false; }
/** * The main query function. Runs the SQL on the connection and handles errors. * @param string $sql sql code * @param bool $errorstop set to false to supress the error message * @return results of the sql statements * @since 0.6 */ function query($sql, $errorstop = true) { global $_zp_DB_connection, $_zp_DB_last_result, $_zp_DB_details; $_zp_DB_last_result = false; if ($_zp_DB_connection) { try { $_zp_DB_last_result = $_zp_DB_connection->query($sql); } catch (PDOException $e) { $_zp_DB_last_result = false; } } if (!$_zp_DB_last_result && $errorstop) { dbErrorReport($sql); } return $_zp_DB_last_result; }
/** * The main query function. Runs the SQL on the connection and handles errors. * @param string $sql sql code * @param bool $errorstop set to false to supress the error message * @return results of the sql statements * @since 0.6 */ function query($sql, $errorstop = true) { global $_zp_DB_connection, $_zp_DB_details; if ($_zp_DB_connection) { if (EXPLAIN_SELECTS && strpos($sql, 'SELECT') !== false) { $result = $_zp_DB_connection->query('EXPLAIN ' . $sql); if ($result) { $explaination = array(); while ($row = $result->fetch_assoc()) { $explaination[] = $row; } } debugLogVar("EXPLAIN {$sql}", $explaination); } if ($result = @$_zp_DB_connection->query($sql)) { return $result; } } if ($errorstop) { dbErrorReport($sql); } return false; }