Advertisement
far_light

3

May 13th, 2018
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. function createSite() {
  2.  
  3. if ($_GET['q'] == 'info' or !isset($_GET['q'])) {
  4. return createMainPage();
  5. } else if ($_GET['q'] == 'buy') {
  6. return "Infp";
  7. } else if ($_GET['q'] == 'about') {
  8. return "Info about company";
  9. } else {
  10. return "Error 404";
  11. }
  12. }
  13.  
  14. <?php
  15. // Create info about product
  16. function createMainPage() {
  17. $database = mysqli_connect(
  18. "localhost", "root",
  19. "", "module3"
  20. );
  21.  
  22. if (mysqli_connect_errno()) {
  23. echo "Не подключено!", mysqli_connect_errno(), ": ", mysqli_connect_error();
  24. exit();
  25. }
  26.  
  27. $query = "SELECT * FROM info";
  28. $data = mysqli_fetch_all(
  29. mysqli_query($database, $query),
  30. MYSQLI_ASSOC
  31. );
  32.  
  33.  
  34.  
  35. return $result;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement