db_addr = $db_addr; $this->db_user = $db_user; $this->db_pass = $db_pass; $this->db_name = $db_name; if (DB_PCONNECT == true) { $connectfunc = "mysql_pconnect"; } else { $connectfunc = "mysql_connect"; } $this->link = $connectfunc($db_addr, $db_user, $db_pass) or $this->error("Could not connect to database server. Check that the values of DB_ADDR, DB_USER and DB_PASS in hlstats.php are set correctly."); mysql_select_db($db_name, $this->link) or $this->error("Could not select database '$db_name'. Check that the value of DB_NAME in hlstats.php is set correctly."); } function data_seek ($row_number, $result=-1) { if ($result < 0) $result = $this->result; return mysql_data_seek($result, $row_number); } function fetch_array ($result=-1) { if ($result < 0) $result = $this->result; $this->rowdata = mysql_fetch_array($result); return $this->rowdata; } function fetch_row ($result=-1) { if ($result < 0) $result = $this->result; $this->rowdata = mysql_fetch_row($result); return $this->rowdata; } function free_result ($result=-1) { if ($result < 0) $result = $this->result; return mysql_free_result($result); } function insert_id () { $this->insert_id = mysql_insert_id($this->link); return $this->insert_id; } function num_rows ($result=-1) { if ($result < 0) $result = $this->result; $this->numrows = mysql_num_rows($result); return $this->numrows; } function query ($query, $showerror=true) { global $db_debug; $this->query = $query; $this->result = mysql_query($query, $this->link); if ($db_debug) { echo "
$query
\n" .
"Error Diagnostic:
\n$message
\n" . "Server Error: (" . mysql_errno() . ") " . mysql_error() . "
\n" .
"Last SQL Query:
\n
$this->query", $exit ); } function dberror () { return mysql_error(); } } ?>