Guest User

Untitled

a guest
Nov 19th, 2018
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. include 'db.php';
  2.  
  3. abstract class Example
  4. {
  5. public $firstname;
  6. public $lastname;
  7. public $age;
  8. public $city;
  9. public $country;
  10.  
  11.  
  12. function __construct()
  13. {
  14. $this->firstname=$info['firstname'];
  15. $this->lastname=$info['lastname'];
  16. $this->age=$info['age'];
  17. $this->city=$info['city'];
  18. $this->country=$info['country'];
  19. }
  20.  
  21. abstract function GetInfo();
  22. }
  23.  
  24. class First extends Example
  25. {
  26.  
  27. function GetInfo()
  28. {
  29. print "Your Name Is : n" . $this->firstname . "<br>";
  30. print "Your Lastname Is : n" . $this->lastname . "<br>";
  31. }
  32.  
  33. }
  34.  
  35. $first = new First;
  36. print $first->GetInfo();
  37.  
  38. class Second extends Example
  39. {
  40.  
  41. function GetInfo()
  42. {
  43. print "Your Age Is : n" . $this->age . "<br>";
  44. print "Your City Is : n" . $this->city . "<br>";
  45. print "Your Country Is : n" . $this->country . "<br>";
  46. }
  47.  
  48. }
  49.  
  50. $second = new Second;
  51. print $second->GetInfo();
  52.  
  53. $hostname = "localhost";
  54. $username = "root";
  55. $password = "";
  56. $database = "website";
  57.  
  58. $connection = mysqli_connect($hostname , $username , $password , $database);
  59.  
  60. if(!$connection)
  61. {
  62. die("No Connection" . mysqli_connect_error());
  63. }
  64.  
  65. $sql='SELECT * FROM `info`';
  66. $result=mysqli_query($connection, $sql);
  67.  
  68. if(mysqli_num_rows($result) > 0)
  69. {
  70. while($row=mysqli_fetch_assoc($result))
  71. {
  72. $info[]=$row;
  73. }
  74.  
  75. return $info;
  76. }
Add Comment
Please, Sign In to add comment