[ create a new paste ] login | about

Link: http://codepad.org/jfxVE0gi    [ raw code | output | fork ]

PHP, pasted on Jun 11:
<?php

class Database {
 private static $Instance;
 private $query = '';

private function __construct() 
{ 
}

public static function getInstance()
{
    if (!self::$Instance)
    {
        self::$Instance= new Database();
    }

    return self::$Instance;
}

public function query($table)
{
     $this->query = "select * from $table";
     return $this;
}

public function result()
{
    echo $this->query;

}
}


$db = Database::getInstance();
$db->query('user_tb')->result();

?>


Output:
1
select * from user_tb


Create a new paste based on this one


Comments: