/ Published in: PHP
URL: http://bettesmidler.com/code/2009-09-18.htm
Simple MySQL DB class.
Expand |
Embed | Plain Text
class Db { private $_conf = false; public function __construct() { $this->parseConf(); $this->dbConnect(); } private function parseConf() { } private function dbConnect() { echo 'no db details found'; exit; } else { $db = $this->_conf['database']; } } private function quote($str='') { } private function query($query=false) { } // public functions public function result($query=false) { } public function results($query=false) { $ar = false; if ($query) { $res = $this->query($query); if ($res) { $ar[] = $r; } } } return $ar; } foreach ($data as $key => $d) { $data[$key] = "'" . $this->quote($d) . "'"; } } $query = "INSERT INTO " . $tbl . " } else { return false; } } foreach ($data as $key => $d) { $line = $key . "="; $set[] = $line; } $query = "UPDATE " . $tbl . " WHERE " . $where; return $this->query($query); } else { return false; } } public function delete($tbl=false, $where=false) { if ($tbl && $where) { return $this->query("DELETE FROM " . $tbl . " WHERE " . $where); } else { return false; } } public function debug($a) { echo "<pre>"; echo "</pre>"; } }
Comments
Subscribe to comments
You need to login to post a comment.

too bad the code ain't documented.