Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SKRYPT
- <html>
- <head>
- <title> Zadanie 7.1 </title>
- </head>
- <body>
- <a href = "zad6_1.php">COFNIJ</a>
- <?php
- $servername = "localhost";
- $username = "root";
- $password = "";
- $dbname = "studenci";
- $conn = new mysqli($servername, $username, $password, $dbname);
- if ($conn->connect_error) {
- die("Connection failed: " . $conn->connect_error);
- }
- $idstudent=$_POST['idstudent'];
- $imie = $_POST['imie'];
- $nazwisko = $_POST['nazwisko'];
- $grupa = $_POST['grupa'];
- $sql_dod = "UPDATE student set imie = '$imie', nazwisko = $'nazwisko', grupa = '$grupa' WHERE idstudent = '$idstudent'";
- $result1 = $conn->query($sql_dod);
- $conn->close();
- ?>
- </body>
- </html>
- HTML
- <html>
- <head>
- <title> Zadanie 6.1 </title>
- </head>
- <body>
- <?php
- $servername = "localhost";
- $username = "root";
- $password = "";
- $dbname = "studenci";
- $conn = new mysqli($servername, $username, $password, $dbname);
- if ($conn->connect_error) {
- die("Connection failed: " . $conn->connect_error);
- }
- $sql = "SELECT idstudent, imie, nazwisko, grupa FROM student";
- $result = $conn->query($sql);
- echo "<table border='1'>";
- echo '<tr>';
- echo '<td> idstudent </td>';
- echo '<td> imie </td>';
- echo '<td> nazwisko </td>';
- echo '<td> grupa </td>';
- echo '</tr>';
- if ($result->num_rows > 0) {
- while($row = $result->fetch_assoc()) {
- echo "<tr><td>" . $row["idstudent"]. "</td><td>" . $row["imie"]. "</td><td>"
- . $row["nazwisko"]. "</td><td>" .$row['grupa']. "</td>"
- . "</tr>";
- }
- } else {
- echo "0 results";
- }
- echo '</table>';
- $conn->close();
- ?>
- <fieldset>
- <legend> Edytuj studenta </legend>
- <form action ="dodawanie.php" method ="POST">
- imie:<input type="text" name="imie"><br>
- nazwisko:<input type="text" name="nazwisko"><br>
- grupa:<input type="text" name="grupa"><br>
- Nr.ID:<input type="text" name="idstudent"><br>
- <input type="submit" value="Edytuj"><br>
- </form>
- </fieldset>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement