Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- include 'db.php';
- abstract class Example
- {
- public $firstname;
- public $lastname;
- public $age;
- public $city;
- public $country;
- function __construct()
- {
- $this->firstname=$info['firstname'];
- $this->lastname=$info['lastname'];
- $this->age=$info['age'];
- $this->city=$info['city'];
- $this->country=$info['country'];
- }
- abstract function GetInfo();
- }
- class First extends Example
- {
- function GetInfo()
- {
- print "Your Name Is : n" . $this->firstname . "<br>";
- print "Your Lastname Is : n" . $this->lastname . "<br>";
- }
- }
- $first = new First;
- print $first->GetInfo();
- class Second extends Example
- {
- function GetInfo()
- {
- print "Your Age Is : n" . $this->age . "<br>";
- print "Your City Is : n" . $this->city . "<br>";
- print "Your Country Is : n" . $this->country . "<br>";
- }
- }
- $second = new Second;
- print $second->GetInfo();
- $hostname = "localhost";
- $username = "root";
- $password = "";
- $database = "website";
- $connection = mysqli_connect($hostname , $username , $password , $database);
- if(!$connection)
- {
- die("No Connection" . mysqli_connect_error());
- }
- $sql='SELECT * FROM `info`';
- $result=mysqli_query($connection, $sql);
- if(mysqli_num_rows($result) > 0)
- {
- while($row=mysqli_fetch_assoc($result))
- {
- $info[]=$row;
- }
- return $info;
- }
Add Comment
Please, Sign In to add comment