Guest User

Untitled

a guest
Mar 31st, 2014
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.74 KB | None | 0 0
  1. <?php
  2.     Class db {
  3.         private $db;
  4.         private $result;
  5.  
  6.         public function __construct ($db_host = "localhost", $db_user = "vh9510_root", $db_password = "AwALHEaBG", $db_name = "vh9510_root") {
  7.             $this->db = mysql_connect($db_host, $db_user, $db_password);
  8.             mysql_select_db($db_name);
  9.             mysql_query("SET NAMES utf8");
  10.         }
  11.  
  12.         public function jqery($sql = '') {            // SQL запрос
  13.             $this->result = mysql_query($sql);
  14.             return $this->result;
  15.         }
  16.  
  17.         public function rows($result = '') {    // Количество строк
  18.             return mysql_num_rows($result);
  19.         }
  20.  
  21.         public function fetch($result = '') {
  22.             return mysql_fetch_array($result);
  23.         }
  24.  
  25.         public function __destruct() {
  26.             mysql_close($this->db);
  27.         }
  28.     }
  29. ?>
Advertisement
Add Comment
Please, Sign In to add comment