Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class DbAction{
- public $query;
- public $result;
- private $connection;
- public $num_rows;
- private $host;
- private $db_user;
- private $db_password;
- private $db_name;
- /*
- Constructo Starts
- */
- public function __construct(){
- $this -> connection;
- $this -> query = '';
- $this -> result = '';
- $this -> numRows = '';
- $this -> host = "localhost";
- $this -> db_user = "root";
- $this -> db_password = "";
- $this -> db_name = "osadnicy";
- }
- /*
- Starts Connection
- */
- public function connection(){
- $this -> connection = new mysqli($this -> host, $this -> db_user, $this -> db_password, $this -> db_name );
- if($this -> connection == true){
- return true;
- } else {
- $this -> errorRaport();
- return false;
- }
- }
- /*
- Returns result
- */
- public function getResult($query){
- $this -> query = $query;
- if ($this -> result = mysql_query($this-> query)==true) {
- return $this -> result;
- } else{
- return "Nie działa";
- }
- }
- public function row(){
- if($this -> numRows = mysql_num_rows( $this -> result)){
- return $this -> numRows;
- }else{
- return false;
- }
- }
- }
- $db = new DbAction();
- $db -> query("SELECT * FROM `uzytkownicy`");
- var_dump($db -> result);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement