Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $nachnameFinden="";
- if(isset($_GET["nachnameFinden"])){
- $nachnameFinden=$_GET["nachnameFinden"];
- }
- $db=new mysqli("localhost","root","","kundendb");
- //var_dump($db);
- $query="SELECT * FROM tblKunde WHERE Nachname LIKE ?";
- $stmt=$db->prepare($query);
- $stmt->bind_param("s", $nachnameFinden);
- $stmt->execute();
- $result=$stmt->get_result()
- ?>
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="ISO-8859-1">
- <title>Tabelle</title>
- </head>
- <body>
- <form action="SuchTabelle.php" method="get">
- <div>
- <input type="text" value="Nachname suchen" name="nachnameFinden" id="nachnameFinden">
- <input type="submit" value="Finden">
- </div>
- </form>
- <table width="500" border="1" cellspacing="0" >
- <thead>
- <tr>
- <th>Anrede</th>
- <th>Vorname</th>
- <th>Nachname</th>
- <th>TelNr</th>
- </tr>
- </thead>
- <tbody>
- <?php
- while ($row=$result->fetch_object()) {
- echo "<tr>";
- echo "<td>".$row->Anrede."</td>";
- echo "<td>".$row->Vorname."</td>";
- echo "<td>".$row->Nachname."</td>";
- echo "<td>".$row->Telefonnr."</td>";
- echo "</tr>";
- }
- ?>
- </tbody>
- </table>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement