Location: PHPKode > projects > Absolut Engine > absolut-engine-33870/admin/classdb.php
<?

// Class for accessing the MySQL database
class CDatabase
{

   function CDatabase()
   {
   // do nothing
   }

   // Connects to the database
   function DBConnect()
   {
   @$connection=mysql_pconnect($this->dbserver,$this->dbuser,$this->dbpass);
   if (!$connection) $this->DisplayError(3);
   mysql_select_db($this->dbname);
   }

   // Queries the database
   function DBQuery($query)
   {
   @$this->outcome=mysql_query($query);
   if (!$this->outcome) $this->DisplayError(2,""," ".$this->emailwebmaster);
   $this->insertID=mysql_insert_id(); // gets insertID to use later
   if (substr($query,0,6)=="SELECT") $this->rowsnumber=mysql_num_rows($this->outcome); // gets number of rows selected to use later
   else $this->rowsnumber=mysql_affected_rows(); // gets number of rows affected to use later
   }

   // Alias function to DBGetRow() for backward compatibility
   function DBAccess()
   {
   return $this->DBGetRow();
   }

   // Gets one row from query
   function DBGetRow()
   {
   return $this->access=mysql_fetch_array($this->outcome);
   }

}
Return current item: Absolut Engine