Want help with php mysql class

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Want help with php mysql class

    I am tring to get this class to work it displays no errors but it also isn't getting any records from the database

    Code:
    <?php
    
    #this script is a part of downloadcity
    #Must not be used for anything else
    
    
    class database
    {
        private $dbhost;
        private $dbuser;
        private $dbpass;
        private $dbname;
    
         function __construct($dbhost, $dbuser, $dbpass, $dbname)
         {
    
              $this->dbname = $dbname;
              $this->dbuser = $dbuser;   
              $this->dbpass = $dbpass;
              $this->dbhost = $dbhost;
    
         }
    
         protected function __connect()
         {
              return @mysql_connect($this->dbhost, $this->dbuser, $this->dbpass);
    
         }
    
    
         protected function __connectDatabase()
         {
              return @mysql_select_db($this->dbname, database::__connect);
         }
    
    
         public static function getAll($table="")
         {
              return @mysql_query("SELECT * FROM ".$table."", database::__connectDatabase);
         }
    
         
         public static function getUnique($table="", $idField, $id)
         {
              return @mysql_query("SELECT * FROM ".$table." WHERE ".$idField."='{$id}'", database::__connectDatabase);
         } 
              
         public static function getAllOrderBy($table="", $orderField, $orderMethod)
         {
              return @mysql_query("SELECT * FROM ".$table." ORDER BY ".$orderField." ".$orderMethod."", database::__connectDatabase);
         }
    
         public static function getBySql($sql="")
         {
              return @mysql_query($sql, database::__connectDatabase);
         }
    
    
         public static function killConnection()
         {
           return @mysql_close(database::__connectDatabase);
         }
    
         
    
    } 
    #end class to handle mysql connection        
    
      
    
    ?>

    #2
    If u want a db class use Zend Db.

    Comment

    Working...
    X