Advertisement
Guest User

Untitled

a guest
May 13th, 2017
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. <?php
  2. // start MySQL connection
  3. $mysql_server = "*****";
  4. $mysql_user = "******";
  5. $mysql_pass = "*****";
  6. $mysql_db = "******";
  7.  
  8. mysql_connect($mysql_server, $mysql_user, $mysql_pass);
  9. mysql_select_db($mysql_db);
  10. ?>
  11. <html>
  12. <head>
  13. <title>PHP-test</title>
  14. </head>
  15. <body>
  16. <?php
  17. // do query
  18. if (!isset($_GET["id"]))
  19. {
  20. echo("
  21. <h2>Proefwerkgegevens in de database</h2>
  22. <ol>");
  23. $res = mysql_query("SELECT `ll_id`, `Voornaam`, `Achternaam` FROM `Proefwerken`");
  24. while($row=mysql_fetch_array($res))
  25. {
  26. echo("<li><a href=\"?id=".$row['ll_id']."\">".htmlentities($row['Voornaam'])." ".htmlentities($row['Achternaam'])."</a></li>");
  27. }
  28. echo("</ol>");
  29. }
  30. else
  31. {
  32. $res = mysql_query("SELECT * FROM `Proefwerken` WHERE `ll_id`='".$_GET['id']."'");
  33. while($row=mysql_fetch_array($res))
  34. {
  35. echo("<h2>Detail-gegevens voor: ".htmlentities($row['Voornaam'])." ".htmlentities($row['Achternaam'])."</h2>
  36. leerling-id: <b>".htmlentities($row['ll_id'])."</b><br>
  37. naam: <b>".htmlentities($row['Voornaam'])." ".htmlentities($row['Achternaam'])."</b><br>
  38. cijfer: <b>".htmlentities($row['Cijfer'])."</b><br>
  39. <hr>
  40. <a href=\"?\">
  41. Terug naar het overzicht</a>");
  42. }
  43. }
  44.  
  45.  
  46. ?>
  47. </body>
  48. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement