Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2017
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. <?php
  2. $nachnameFinden="";
  3. if(isset($_GET["nachnameFinden"])){
  4. $nachnameFinden=$_GET["nachnameFinden"];
  5. }
  6. $db=new mysqli("localhost","root","","kundendb");
  7. //var_dump($db);
  8. $query="SELECT * FROM tblKunde WHERE Nachname LIKE ?";
  9. $stmt=$db->prepare($query);
  10. $stmt->bind_param("s", $nachnameFinden);
  11. $stmt->execute();
  12. $result=$stmt->get_result()
  13. ?>
  14.  
  15. <!DOCTYPE html>
  16. <html>
  17. <head>
  18. <meta charset="ISO-8859-1">
  19. <title>Tabelle</title>
  20. </head>
  21. <body>
  22. <form action="SuchTabelle.php" method="get">
  23. <div>
  24. <input type="text" value="Nachname suchen" name="nachnameFinden" id="nachnameFinden">
  25. <input type="submit" value="Finden">
  26. </div>
  27. </form>
  28. <table width="500" border="1" cellspacing="0" >
  29. <thead>
  30. <tr>
  31. <th>Anrede</th>
  32. <th>Vorname</th>
  33. <th>Nachname</th>
  34. <th>TelNr</th>
  35. </tr>
  36. </thead>
  37. <tbody>
  38. <?php
  39. while ($row=$result->fetch_object()) {
  40.  
  41. echo "<tr>";
  42. echo "<td>".$row->Anrede."</td>";
  43. echo "<td>".$row->Vorname."</td>";
  44. echo "<td>".$row->Nachname."</td>";
  45. echo "<td>".$row->Telefonnr."</td>";
  46. echo "</tr>";
  47. }
  48. ?>
  49. </tbody>
  50. </table>
  51. </body>
  52. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement