Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php header('Content-type: text/html; charset=iso-8859-2'); ?>
- <html>
- <header>
- <link rel="stylesheet" type="text/css" href="mystyle.css">
- </header>
- <head>Wypożyczalnia</head>
- <body>
- <?php
- $dbhost = 'localhost';
- $dbuser = '15_koziol';
- $dbpass = 'U6t9r6y1r1';
- $dbname = '15_koziol';
- $conn = mysql_connect($dbhost, $dbuser, $dbpass);
- if (!$conn ) {
- die('Bład połączenia z serwerem: ' . mysql_error());
- }
- mysql_select_db($dbname);
- echo "<table>";
- //sortowanie
- if(isset($_POST['sort']))
- {
- echo "Posortowane dane wg ".$_POST['sort']." :<br>";
- $wynik = mysql_query("SELECT * FROM samochody ORDER BY ".$_POST['sort'].";");
- } else {
- $wynik=mysql_query("SELECT * FROM samochody;",$conn);
- }
- echo "<table border='1'>";
- echo "<tr>";
- echo "<td>Akcja</td>";
- for ($i=1; $i<mysql_num_fields($wynik); $i++)
- {
- $tabela=mysql_fetch_field($wynik, $i);
- echo "<td><form action='' method='POST'><input type ='submit' value=$tabela->name name='sort'></form></td>";
- }
- echo "</tr>";
- while ($wiersz = mysql_fetch_array($wynik, MYSQL_ASSOC)) {
- echo "<tr>";
- $i=0;
- foreach($wiersz as $komorka)
- {
- if($i==0)echo "<td><form action='next.php' method='POST'><input type='hidden' value='$komorka' name='xyz'><input type='submit' value='wybor' name=''></form></td>";
- else echo "<td>".$komorka."</td>";
- $i++;
- }
- }
- echo "</tr>";
- echo "<br>";
- echo "</table>";
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement