Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <title>druzyny</title>
- </head>
- <body bgcolor="white">
- <?php
- $link = pg_connect("host=labdb dbname=mrbd user=gb357712 password=x");
- $result = pg_query($link, "select * from druzyny");
- $numrows = pg_numrows($result);
- ?>
- <h2 align=center>Nasze gatunki</h2>
- <table border="1" align=center>
- <tr>
- <th>Nazwa</th>
- <th>Trener</th>
- </tr>
- <?php
- // Loop on rows in the result set.
- for($ri = 0; $ri < $numrows; $ri++) {
- echo "<tr>\n";
- $row = pg_fetch_array($result, $ri);
- echo " <td>" . $row["Nazwa"] . "</td>
- <td>" . $row["Trener"] . "</td>
- </tr>
- ";
- }
- pg_close($link);
- ?>
- </table>
- </body>
- </html>
- <html>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <title>Wstaw zawodnika</title>
- <body>
- <?php
- $Nazwa = $_POST["Nazwa"];
- $Trener = $_POST["Trener"];
- $link = pg_connect("host=labdb dbname=mrbd user=gb357712 password=x");
- $wynik = pg_query($link,
- "INSERT INTO Druzyny VALUES ('"
- . pg_escape_string($Nazwa) .
- "','" . pg_escape_string($Trener) . "')");
- if ($wynik) {
- echo "OK";
- }
- else {
- echo "Nie udalo sie?!<br>";
- echo pg_last_error($link) . "<br>";
- }
- ?>
- </body>
- </html>
- <html>
- <head>
- <title>Zawodnicy</title>
- </head>
- <body bgcolor="white">
- <?php
- $link = pg_connect("host=labdb dbname=mrbd user=gb357712 password=x");
- $result = pg_query($link, "select * from zawodnicy");
- $numrows = pg_numrows($result);
- ?>
- <h2 align=center>Nasze gatunki</h2>
- <table border="1" align=center>
- <tr>
- <th>ID</th>
- <th>Imie</th>
- <th>Nazwisko</th>
- <th>Druzyna</th>
- </tr>
- <?php
- // Loop on rows in the result set.
- for($ri = 0; $ri < $numrows; $ri++) {
- echo "<tr>\n";
- $row = pg_fetch_array($result, $ri);
- echo " <td>" . $row["ID"] . "</td>
- <td>" . $row["Imie"] . "</td>
- <td>" . $row["Nazwisko"] . "</td>
- <td>" . $row["Druzyna"] . "</td>
- </tr>
- ";
- }
- pg_close($link);
- ?>
- </table>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement