Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class DatabaseConnection {
- public $dbconnection;
- public $dbhost;
- public $dbuser;
- public $dbpass;
- public $dbname;
- // Create connection
- public function __construct($dbhost, $dbuser, $dbpass, $dbname) {
- $this->dbconnection = new mysqli($this->dbhost = $dbhost, $this->dbuser = $dbuser, $this->dbpass = $dbpass, $this->dbname = $dbname);
- }
- }
- class sql extends DatabaseConnection {
- public $sql;
- public function __construct($sql) {
- if ($this->dbconnection->query($this->sql=$sql) === TRUE) {
- echo "New record created successfully";
- } else {
- echo "Error: " . $this->sql . "<br>" . $this->dbconnection->error;
- }
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement