Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class Database{
- private $hostname;
- private $databasename;
- private $username;
- private $password;
- private $connect;
- public $result;
- public function __construct($hostname, $databasename, $username, $password){
- $this->hostname = $hostname;
- $this->databasename = $databasename;
- $this->username = $username;
- $this->password = $password;
- $this->connect = MySQL_Connect($hostname, $username, $password) or die(MySQL_Error());
- MySQL_Select_Db($this->databasename);
- }
- public function execute($sql){
- $this->sql = $sql;
- $this->result = MySQL_Query($this->sql) or die(MySQL_Error());
- }
- private function fetch(){
- include('Security.class.php');
- $numargs = func_num_args();
- $arg_list = func_get_args();
- while($row = MySQL_Fetch_Object($this->result)){
- for ($i = 0; $i < $numargs; $i++) {
- if(isset($this->f1)){
- echo $this->f1;
- }
- echo Security::h($row->$arg_list[$i]);
- if(isset($this->f2)){
- echo $this->f2;
- }
- }
- }
- }
- private function getFormatting($f1,$f2){
- $this->f1 = $f1;
- $this->f2 = $f2;
- }
- /*private function __destruct(){
- $close = MySQL_Close($this->connect);
- if($close){
- echo "Database connection has been closed succesfully";}
- } */
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement