Advertisement
Guest User

Untitled

a guest
Mar 30th, 2017
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. automobili.php
  2.  
  3.  
  4. <?php require('connect.php'); ?>
  5. <!DOCTYPE html>
  6. <html>
  7. <head>
  8. <title>Popis</title>
  9.  
  10.  
  11. </head>
  12. <body>
  13. <h1>Popis</h1>
  14.  
  15. <?php
  16. $sql = "SELECT brands.name, cars.id, cars.model, cars.color, cars.mileage FROM brands, cars WHERE brands.id = cars.brand_id ORDER BY name";
  17. $result = $mysqli->query($sql);
  18. ?>
  19. <ul>
  20. <?php
  21. while ($cars = $result->fetch_assoc()) {
  22. echo('<li><a href="proizvodaci.php?id=' . $cars['id'] . '">' . $cars['name'] . '</a>/'. $cars['model'] .'/'. $cars['color']);
  23. }
  24. ?>
  25.  
  26. </ul>
  27. </body>
  28. </html>
  29.  
  30.  
  31.  
  32. proizvodaci.php
  33.  
  34. <?php require('connect.php'); ?>
  35. <!DOCTYPE html>
  36. <html>
  37. <head>
  38. <title>Proizvođači</title>
  39.  
  40.  
  41. </head>
  42. <body>
  43. <h1>Proizvođači</h1>
  44.  
  45. <?php
  46. $sql = "SELECT id, name, year_est FROM brands WHERE id=" . $_GET['id'];
  47. $result = $mysqli->query($sql);
  48. $brands = $result->fetch_assoc();
  49. echo($brands['name'] ." " . $brands['year_est']);
  50.  
  51.  
  52. ?>
  53.  
  54. </body>
  55. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement