connect())) { $this->error = mysql_error(); return(false); } return(true); } // standard query to mysql server return the results. function query($query) { $this->result = mysql_query($query,$this->connect()); if (!@$this->result) { $this->error = mysql_error(); return(false); } return($this->result); } // clean up after object function flush() { $this->error = false; if (!@mysql_free_result($this->result)) { $this->error = mysql_error(); return(false); } $this->result = false; return(true); } //PRIVATE: // Logon information specific to this object. var $hostname; var $username; var $password; // information about the connection var $resourceid; var $database; // initialization function function MYSQL($host=false,$user=false,$pass=false,$db=false) { $this->hostname = $host; $this->username = $user; $this->password = $pass; $this->database = $db; $this->resourceid = false; $this->result = false; } // attempt to connect to the database function connect() { if (empty($this->resourceid) && !empty($this->database)) { $this->resourceid = mysql_pconnect($this->hostname,$this->username,$this->password); mysql_select_db($this->database,$this->resourceid); } return($this->resourceid); } } ?>