Guest User

Untitled

a guest
Dec 19th, 2020
26
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. function __construct($id)
  2. {
  3. $this->PersonArray[]=array();
  4. $this->ID=$id;
  5. $connect = mysqli_connect("localhost","root","");
  6. If (!$connect)
  7. {
  8. Die('could not connect: ' .mysqli_error());
  9. }
  10. $databaseSelected=mysqli_select_db($connect,"oplatek");
  11. $sqlRequest="SELECT * FROM `users`;";
  12. $id=0;
  13. $result=mysqli_query($connect,$sqlRequest);
  14. if ($result->num_rows > 0)
  15. {
  16.  
  17. while($row = $result->fetch_assoc())
  18. {
  19. $id++;
  20. $User=$row["name"].' '.$row["Surname"];
  21. $this->PersonArray[]=new Person($id,$User);
  22. }
  23. }
  24. mysqli_close($connect);
Advertisement
Add Comment
Please, Sign In to add comment