Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- define("HOST", "localhost");
- define("USER", "root");
- define("PASS", "");
- define("DB", "test");
- class db{
- public static $connect;
- public static $test;
- public function __construct(){
- $this->connect = new mysqli(HOST, USER, PASS, DB) or die ("Error: cannot connection to the database");
- $this->connect->query("SET NAMES 'utf8'");
- return $this->connect;
- }
- public function query($query) {
- $success = $this->connect->query($query);
- if ($success)
- return 1;
- else return 0;
- }
- }
- $db = new db();
- $db->query("UPDATE users SET name='ololol' WHERE id=1");
- /*
- UPDATE users SET name='test' WHERE id=1
- */
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement