Class exercise: linking SQL to PHP
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.php 499B

1234567891011121314151617181920212223242526272829303132333435
  1. <html>
  2. <head>
  3. </head>
  4. <body>
  5. <?php
  6. $dataBase = new SQLite3("Northwind_large.sqlite");
  7. $result = $dataBase->query('SELECT * FROM Category');
  8. $numColumns = $result->numColumns();
  9. ?>
  10. <table>
  11. <tr>
  12. <?php
  13. for($y =0; $y < $numColumns; ++$y)
  14. {
  15. echo "<th>" . $result->ColumnName($y) . "</th>";
  16. }
  17. ?>
  18. </tr>
  19. <?php
  20. while($row = $result->fetchArray()){
  21. echo "<tr>";
  22. for($i = 0; $i < sizeof($row); $i++)
  23. {
  24. echo "<td>" . $row[$i] . "</td>";
  25. }
  26. echo "</tr>";
  27. }
  28. ?>
  29. </body>
  30. </html>