Guest User

Untitled

a guest
Jun 14th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. <?php
  2.  
  3. class DB {
  4. private $dbhost="localhost";
  5. private $dblogin="root";
  6. private $dbpassword="holyfuck";
  7. private $dbschema="u4srv";
  8. private $dbtablepfx="";
  9. private $conn;
  10.  
  11.  
  12. function __construct() {
  13. $this->conn = mysql_connect($this->dbhost, $this->dblogin, $this->dbpassword);
  14. return mysql_select_db($this->dbschema);
  15. }
  16.  
  17. function __destruct() {
  18. mysql_close();
  19. }
  20.  
  21. function Query($query) {
  22. return mysql_query($query);
  23. }
  24.  
  25. function Count($table,$query) {
  26. $dbtablepfx = $this->dbtablepfx;
  27. $a=$this->Query("SELECT * FROM $dbtablepfx$table $query");
  28. return mysql_num_rows($a);
  29. }
  30.  
  31. function Get($table,$query) {
  32. $dbtablepfx = $this->dbtablepfx;
  33. $a = $this->Query("SELECT * FROM $dbtablepfx$table WHERE $query");
  34. $r = mysql_fetch_array($a);
  35. return $r;
  36. }
  37.  
  38. function Insert($table,$values) {
  39. $dbtablepfx = $this->dbtablepfx;
  40. return $this->Query("INSERT INTO $dbtablepfx$table VALUES ($values)");
  41. }
  42.  
  43. function Select($table,$opt) {
  44. $dbtablepfx = $this->dbtablepfx;
  45. return $this->Query("SELECT * FROM $dbtablepfx$table $opt");
  46. }
  47.  
  48. function Delete($table, $where) {
  49. $dbtablepfx = $this->dbtablepfx;
  50. return $this->Query("DELETE FROM $dbtablepfx$table $where");
  51. }
  52.  
  53. }
  54.  
  55. ?>
Add Comment
Please, Sign In to add comment