Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class Database{
- var $con =0;
- function Database($dbname="", $dbhost="", $dbusername="", $dbpass="")
- {
- $this->dbname = $dbname;
- $this->dbhost = $dbhost;
- $this->dbusername = $dbusername;
- $this->dbpass = $dbpass;
- }
- function connect() {
- $this->con =@mysql_connect($this->dbhost,$this->dbusername,$this->dbpass, false);
- if (!$this->con) {//open failed
- return false;
- }
- if(!@mysql_select_db($this->dbname, $this->con)) {//no database
- return false;
- }
- // unset the data so it can't be dumped
- $this->dbhost='';
- $this->dbusername='';
- $this->dbpass='';
- $this->dbname='';
- }
- }
- //execute query
- function setQuery($sql)
- {
- echo 'This is a test';
- // do query
- $this->query_id = @mysql_query($sql, $this->con);
- if (!$this->query_id) {
- echo "<b>MySQL Query fail:</b> $sql";
- return 0;
- }
- return true;
- }//EOF
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement