Advertisement
Guest User

Untitled

a guest
May 21st, 2020
12
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. <?php
  2. include ("connect.php");
  3.  
  4. !isset($_GET["page"]) ? $page = 1 : $page = $_GET["page"];
  5.  
  6. $query_car = "SELECT * FROM car";
  7. $table_car = mysqli_query($link,$query_car);
  8. for ($i=0; $i < mysqli_num_rows($table_car) ; $i++) {
  9. $row = mysqli_fetch_array($table_car);
  10. $id[$i] = $row["id"];
  11. $name[$i] = $row["name"];
  12. }
  13. $query_car_foto = "SELECT * FROM car_foto WHERE id_car='$page'";
  14. $table_car_foto = mysqli_query($link,$query_car_foto);
  15. for ($i=0; $i < mysqli_num_rows($table_car_foto) ; $i++) {
  16. $row = mysqli_fetch_array($table_car_foto);
  17. $img[$i] = $row["foto"];
  18. }
  19. ?>
  20. <!DOCTYPE html>
  21. <html lang="ru">
  22. <head>
  23. <link rel="stylesheet" type="text/css" href="z1.css">
  24. <meta charset="UTF-8">
  25. <title>Auto</title>
  26. </head>
  27. <body>
  28. <table width="100%">
  29. <tr>
  30. <td class="logo">
  31. <p>Лучшие авто мира</p>
  32. </td>
  33. <td rowspan="2">
  34. <?php for ($i=0; $i < count($img) ; $i++): ?>
  35. <p><img src="<?= $img[$i]?>"></p>
  36. <?php endfor ?>
  37. </td>
  38. </tr>
  39. <tr>
  40. <td class="menu" rowspan="2">
  41. <?php for ($i=0; $i < count($name) ; $i++): ?>
  42. <a href="?page=<?=$id[$i]?>" <?= $i == $page - 1 ? "style=color:white" : "" ?>><?=$name[$i]?></a>
  43. <?php endfor ?>
  44. </td>
  45. </tr>
  46.  
  47. </table>
  48. </body>
  49. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement