link_id == 0) { if ($pconnect) { $this->link_id = @mysql_pconnect($server, $user, $password); } else { $this->link_id = @mysql_connect($server, $user, $password); } if (!$this->link_id) { $this->throw('Link-Id == false, can not connect'); return false; } $candb = @mysql_select_db($this->database, $this->link_id); if ($candb) { return true; } else { $this->throw('Cannot use the database ' . $this->database); } } } function query($qstring) { $this->query_id = mysql_query($qstring, $this->link_id); $this->current_query = $qstring; $this->query_history[] = $this->current_query; if (!$this->query_id) { $this->throw('Invalid SQL query: ' . $this->current_query); } return $this->query_id; } function fetch_array($query_id) { return @mysql_fetch_array($query_id, MYSQL_ASSOC); } function free_result($query_id) { @mysql_free_result($query_id); $this->query_id = 0; } function query_first($qstring) { $resource = $this->query($qstring); $array = $this->fetch_array($resource); $this->free_result($resource); return $array; } function insert_id() { return mysql_insert_id($this->link_id); } function num_rows($query_id) { return @mysql_num_rows($query_id); } function affected_rows() { return @mysql_affected_rows($this->link_id); } function throw($message) { if ($this->link_id) { $this->error = mysql_error($this->link_id); $this->errno = mysql_errno($this->link_id); } echo "\r"; echo "\r\r\r"; echo "{$this->appname} Error\r\r\r\r\r

An error occured in {$this->appname}

\r\r

\r\t

\r\t\t»"; echo "Query:\r\t\t
\r\t\t
{$this->current_query}
\r\t\t
\r\t\t»Error Number: "; echo "{$this->errno}\r\t\t
\r\t\t
\r\t\t»Error Message: {$this->error}\r\t\t"; echo "
\r\t\t
\r\t\t»File: $_SERVER[PHP_SELF]\r\t
\r

\r\r\r"; exit; } } /*=====================================================================*\ || ################################################################### || # $HeadURL$ || # $Id$ || ################################################################### \*=====================================================================*/ ?>