Guest User

Untitled

a guest
Jan 9th, 2018
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.53 KB | None | 0 0
  1. <?php
  2.  
  3. $servername = "localhost";
  4. $username = "root";
  5. $password = "indicadls02";
  6. $database = "segmentor";
  7. $conn = new mysqli($servername, $username, $password, $database);
  8.  
  9. if ($conn->connect_error) {
  10. die("Connection failed: " . $conn->connect_error);
  11. }
  12.  
  13. echo "Connected successfully <br>";
  14.  
  15. error_reporting(-1);
  16.  
  17. class gang {
  18.  
  19. private $operators;
  20.  
  21. public function fetchOperators() {
  22. $class = get_class($this);
  23. echo "$class <br>";
  24. $class = "PushCrew";
  25. $que = "select * from Operators where Tag = '$class' ";
  26. echo "$que <br>";
  27. if(mysqli_num_rows(mysqli_queri($conn, $que)) > 0) {
  28. echo "query is true <br>";
  29. $operators = $conn->query($que);
  30. print_r($operators);
  31. }
  32. else {
  33. echo "select query failed <br>";
  34. }
  35. }
  36.  
  37. public function getOperators() {
  38. $this->operators = $this->fetchOperators();
  39. if(get_parent_class($this)) {
  40. echo "parent exists <br>";
  41. echo "$this->operators OPS <br>";
  42. $parent = get_parent_class($this);
  43. $temp = new $parent();
  44. $operatorsInherited = $temp->getOperators();
  45. echo "$operatorsInherited inherited<br>";
  46. $this->operators += ($operatorsInherited);
  47. }
  48. else {
  49. echo "tree finished <br>";
  50. }
  51. return $this->operators;
  52. }
  53. }
  54.  
  55. class bang extends gang{
  56. private $operators;
  57. };
  58.  
  59. $ob2 = new bang();
  60. $ob2->fetchOperators();
  61. //$arr = $ob2->getOperators();
  62. //print_r($arr);
Add Comment
Please, Sign In to add comment