Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class DB {
- private $dbhost="localhost";
- private $dblogin="root";
- private $dbpassword="holyfuck";
- private $dbschema="u4srv";
- private $dbtablepfx="";
- private $conn;
- function __construct() {
- $this->conn = mysql_connect($this->dbhost, $this->dblogin, $this->dbpassword);
- return mysql_select_db($this->dbschema);
- }
- function __destruct() {
- mysql_close();
- }
- function Query($query) {
- return mysql_query($query);
- }
- function Count($table,$query) {
- $dbtablepfx = $this->dbtablepfx;
- $a=$this->Query("SELECT * FROM $dbtablepfx$table $query");
- return mysql_num_rows($a);
- }
- function Get($table,$query) {
- $dbtablepfx = $this->dbtablepfx;
- $a = $this->Query("SELECT * FROM $dbtablepfx$table WHERE $query");
- $r = mysql_fetch_array($a);
- return $r;
- }
- function Insert($table,$values) {
- $dbtablepfx = $this->dbtablepfx;
- return $this->Query("INSERT INTO $dbtablepfx$table VALUES ($values)");
- }
- function Select($table,$opt) {
- $dbtablepfx = $this->dbtablepfx;
- return $this->Query("SELECT * FROM $dbtablepfx$table $opt");
- }
- function Delete($table, $where) {
- $dbtablepfx = $this->dbtablepfx;
- return $this->Query("DELETE FROM $dbtablepfx$table $where");
- }
- }
- ?>
Add Comment
Please, Sign In to add comment