Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <title>imie</title>
- </head>
- <body>
- <?php
- $servername = "localhost";
- $dbname = "zadania";
- $username = "root";
- $password = "";
- $connect = mysqli_connect($servername, $username, $password, $dbname);
- if (!$connect) {
- die("Connection failed: " . mysqli_connect_error());
- }
- echo "Connected successfully";
- ?>
- <form method="POST" action="Bartłomiej_Juda_Zadanie_5_4.php">
- <p><input type="text" name="imie1" size="20"> Podaj imie</p>
- <p><input type="submit" value="Dalej" name="przycisk"></p>
- </form>
- <?php
- $imie = $_POST['imie1'];
- $zapytanie = "SELECT * FROM Studenci WHERE '$imie'=Imie";
- $result = mysqli_query($connect,$zapytanie);
- if (mysqli_num_rows($result) > 0) {
- while($row = mysqli_fetch_assoc($result)) {
- echo "id: " . $row["ID_Studenta"]. " - Imie: " . $row["Imie"]. " " . $row["Nazwisko"]. "<br>";
- }
- } else {
- echo "0 results";
- }
- mysqli_close($connect);
- ?>
- </body>
- </html>
Add Comment
Please, Sign In to add comment