Advertisement
Guest User

Untitled

a guest
Oct 13th, 2016
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <!--
  3. To change this license header, choose License Headers in Project Properties.
  4. To change this template file, choose Tools | Templates
  5. and open the template in the editor.
  6. -->
  7. <html>
  8. <head>
  9. <meta charset="UTF-8">
  10. <title></title>
  11. </head>
  12. <body>
  13. <?php $afdnr = 0;
  14. if(!empty($_GET["verzenden"])){
  15. $afdnr = $_GET["afdnr"];
  16. }
  17. //
  18. // $nrRows = $stmt->rowCount();
  19. // if($nrRows = 0){
  20. // print"Helaas is er nu geen record.";}
  21.  
  22. ?>
  23.  
  24. <form method="get">
  25. Afdelingnr: <input type="text" name="afdnr" value="<?php print$afdnr;?>">
  26. <input type="submit" name="verzenden" value="Verzenden">
  27. <br/>
  28. <br/>
  29. <?php
  30.  
  31. $db ="mysql:host=localhost;dbname=cursus;port=3307";
  32. $user ="root";
  33. $pass = "usbw";
  34. $pdo = new PDO($db, $user, $pass);
  35.  
  36.  
  37. // $afdnr = $_GET["afdnr"];
  38.  
  39. $stmt = $pdo->prepare("SELECT * FROM medewerker where afd = ?");
  40. $stmt->execute(array($afdnr));
  41.  
  42. while ($row = $stmt->fetch())
  43. {
  44. $naam = $row["naam"];
  45. $functie = $row["functie"];
  46. print($naam .", ". $functie ."<br>");
  47. }
  48.  
  49. $pdo = NULL;
  50.  
  51. ?>
  52.  
  53.  
  54. </form>
  55. </body>
  56. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement