Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class MySQL
- {
- private $con;
- public function __contruct($host="localhost",$username="root",$password="")
- {
- $this->con = mysql_connect($host,$username,$password);
- if (!$this->con)
- {
- die('Could not connect: ' . mysql_error());
- }
- }
- public function chooseDB($db)
- {
- if($this->con)
- {
- mysql_select_db($db, $this->con);
- return true;
- }
- else
- return false;
- }
- public function query($query)
- {
- if($this->con)
- return mysql_query($query);
- else
- return false;
- }
- public function __destruct()
- {
- if($this->con)
- mysql_close($this->con);
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement