All pastes #511734 Raw Edit

Untitled

public php v1 · immutable
#511734 ·published 2007-05-26 16:40 UTC
rendered paste body
<?php    /**     * @todo Build in Stored Procedures, and clean up.     * @author Josh Team <jteam@creditsolutions.com>     * @package Model     * @version 1.0     */    class MySQL implements DBInterface {		public $dbObj;	public $host;	public $user;	public $pass;	public $database;		public function __construct($host, $user, $pass, $database){                        $this->connect($host, $user, $pass, $database);            	}		private function connect($host,$user,$pass,$database){                        $this->dbObj = new mysqli($host,$user,$pass,$database);            	}                public function query($query) {                        if($this->dbObj->query( $query )) {                                return $this->dbObj->affected_rows;                            } else {                                throw new Exception($this->dbObj->error);                            }                    }		public function getAll($query) {                        if($result = $this->dbObj->query($query)){                                while($row = $result->fetch_assoc()) {                                        $resultset[] = $row;                                    }                            } else {                		throw new Exception($this->dbObj->error);                            }                        return $resultset;            	}		public function getRow($query) {                        if ($result = $this->dbObj->query($query)) {                                $rs = $result->fetch_assoc();                            } else {                		throw new Exception($this->dbObj->error);                            }                        return $rs;            	}		public function getField($query) {                        if ($result = $this->dbObj->query($query)) {                                $rs = $result->fetch_array();                return $rs[0];                            } else {				throw new Exception($this->dbObj->error);			    }            	}		public function getThreadID() {                        $rs = $this->dbObj->thread_id;                        return $rs;            	}		public function getNumRows() {                        return $this->dbObj->affected_rows;            	}		public function cleanString($string) {                        $stringresult = $this->dbObj->real_escape_string($string);                        return $stringresult;                    }                public function storedProc($sp, $params='') {                        return $this->dbObj->insert_id;                    }                public function getLastID() {                        return $this->dbObj->insert_id;                    }            }?>