Advertisement
Guest User

Untitled

a guest
Jun 27th, 2017
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. <?php
  2. include_once("../yleiset/yla.php");
  3. //TODO: Osallistujien (ilmoittautuminen-taulusta) tulostaminen.
  4. $dbConnection=mysql_pconnect("localhost", "root", "");
  5. mysql_select_db("terwamaraton");
  6. $sql="SELECT * FROM ilmoittautuminen ORDER BY nimi asc";
  7.  
  8. $statement=mysql_query($sql);
  9.  
  10. print "<h3>Osallistujat</h3>";
  11.  
  12. if (!$statement)
  13. {
  14. $error=mysql_error();
  15. print $error;
  16. mysql_close($dbConnection);
  17. exit;
  18. }
  19.  
  20. print "<table>";
  21. print "<tr><td></td><td>Nimi</td><td>Seura</td></tr>";
  22. while ($dataArray=mysql_fetch_assoc($statement))
  23. {
  24.  
  25. print "<tr>";
  26.  
  27. print "<td>";
  28. print "$dataArray[id]&nbsp;";
  29. print "</td>";
  30.  
  31.  
  32. print "<td>";
  33. print "$dataArray[nimi]&nbsp;";
  34. print "</td>";
  35.  
  36.  
  37. print "<td>";
  38. print "$dataArray[seura]&nbsp;";
  39.  
  40. print "</td>";
  41. print "</tr>";
  42.  
  43. }
  44. print "</table>";
  45. //Jos teet lisätehtävän, sivun alussa pitää lukea mahdollinen get-parametrin arvo ja muodostaa sen
  46. //perusteella sql-lauseen order by osa.
  47. ?>
  48. <?php
  49. include_once("../yleiset/ala.php");
  50. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement