/** * This method will execute an SQL statement using mysql_query() function * @param String $sql SQL statement to be executed * @return ResultResource If the statement executed success, boolean false in an error */ public function sqlQuery($sql) { if (isset($this->conn) && $sql != '') { $this->result = mysql_query($sql); if ($this->result) { return $this->result; } /* * Return false if duplicate key is entered * TODO: Throw an exception here, and chanage code to catch it on model level */ if (mysql_errno() == 1062) { return false; } $exception_handler = new ExceptionHandler(); $exception_handler->dbexInvalidSQL($sql); return false; } else { $exception_handler = new ExceptionHandler(); $exception_handler->dbexNoQueryFound($sql); return false; } }
function sqlQuery($sql) { if (isset($this->conn) && $sql != '') { $this->result = mysql_query($sql); if ($this->result) { return $this->result; } if (mysql_errno() == 1062) { return false; } $exception_handler = new ExceptionHandler(); $exception_handler->dbexInvalidSQL($sql); return false; } else { $exception_handler = new ExceptionHandler(); $exception_handler->dbexNoQueryFound($sql); return false; } }