Advertisement
Guest User

Untitled

a guest
Jan 15th, 2015
278
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. <?php
  2. define("HOST", "localhost");
  3. define("USER", "root");
  4. define("PASS", "");
  5. define("DB", "test");
  6. class db{
  7. public static $connect;
  8. public static $test;
  9. public function __construct(){
  10. $this->connect = new mysqli(HOST, USER, PASS, DB) or die ("Error: cannot connection to the database");
  11. $this->connect->query("SET NAMES 'utf8'");
  12. return $this->connect;
  13. }
  14.  
  15. public function query($query) {
  16. $success = $this->connect->query($query);
  17. if ($success)
  18. return 1;
  19. else return 0;
  20. }
  21. }
  22.  
  23.  
  24. $db = new db();
  25. $db->query("UPDATE users SET name='ololol' WHERE id=1");
  26.  
  27.  
  28. /*
  29. UPDATE users SET name='test' WHERE id=1
  30. */
  31. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement