Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <title>Zadanie 6.1</title>
- </head>
- <body>
- <?php
- $servername = "localhost";
- $username = "root";
- $password = "";
- $dbname = "uekat";
- $conn = new mysqli($servername, $username, $password, $dbname);
- if ($conn->connect_error) {
- die("Connection failed: " . $conn->connect_error);
- }
- if(isset($_GET['numer']))
- {
- $numer=$_GET['numer'];
- $sql2 = "DELETE FROM studenci WHERE idstudent='$numer'";
- if ($conn->query($sql2) === TRUE) {
- echo "Record deleted successfully";
- } else {
- echo "Error deleting record: " . $conn->error;
- }
- }
- $sql = "SELECT idstudent, imie, nazwisko, grupa FROM studenci";
- $result = $conn->query($sql);
- echo "<fieldset>";
- echo "<legend> Zawartosc tabeli </legend>";
- echo "<table border='1'>";
- echo "<tr><td> idstudent </td>";
- echo "<td> imie </td>";
- echo "<td> nazwisko </td>";
- echo "<td> grupa </td>";
- echo "<td> usun </td></tr>";
- $licznik = "";
- if ($result->num_rows > 0) {
- while($row = $result->fetch_assoc()) {
- $licznik=$row["idstudent"];
- echo "<tr><td>" . $row["idstudent"]. "</td><td>" . $row["imie"]. "</td><td>" . $row["nazwisko"]. "</td><td>" .$row['grupa']. "</td><td>" . "<form action='zadanie6_2.php' method='GET'> <input type='hidden' name='numer' value='$licznik'><input type='image' name='iks' src='iks.png' value='Submit'></form>" . "</td></tr>";
- $licznik++;
- }
- } else {
- echo "0 results";
- }
- echo "</table>";
- echo "</fieldset>";
- $conn->close();
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement