SHARE
TWEET

Untitled

a guest Aug 18th, 2013 27 Never
  1. <?php
  2.  
  3. $dbhost = 'localhost';
  4.  
  5. $user = 'root';
  6.  
  7. $password = 'root';
  8.  
  9. $dbname = 'inventory';
  10.  
  11. $pdo = new PDO("mysql:host=$dbhost; $dbname", $user, $password);
  12.  
  13.  
  14. ?>
  15.  
  16. <html>
  17. <head>
  18. <title>Inventory List</title>
  19. </head>
  20. <body>
  21. <?php
  22.         include 'inventory.php';
  23.        
  24. $list = $pdo->query("SELECT year, make, model, color, price FROM cars ORDER BY price ASC");
  25.  
  26. $results = $list->fetchAll(PDO::FETCH_OBJ);
  27. ?>
  28.  
  29.  
  30.  
  31.  
  32. </body>
  33. </html>
RAW Paste Data
Top