Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [HTML][MySQL][php] ustawienie tabeli
ilov3
post
Post #1





Grupa: Zarejestrowani
Postów: 31
Pomógł: 0
Dołączył: 12.07.2013

Ostrzeżenie: (0%)
-----


Witam, mam problem z ustawieniem tabelki by pozostałe kolumny były również w poziomie.

  1. DROP TABLE IF EXISTS `tabela`;
  2. CREATE TABLE IF NOT EXISTS `tabela` (
  3. `id` varchar(10) CHARACTER SET utf8 COLLATE utf8_polish_ci NOT NULL,
  4. `room_1` varchar(10) CHARACTER SET utf8 COLLATE utf8_polish_ci NOT NULL,
  5. `room_2` varchar(10) NOT NULL,
  6. `room_3` varchar(10) NOT NULL,
  7. PRIMARY KEY (`id`)
  8. ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
  9.  
  10. --
  11. -- Zrzut danych tabeli `tabela`
  12. --
  13.  
  14. INSERT INTO `tabela` (`id`, `room_1`, `room_2`, `room_3`) VALUES
  15. ('Ilość osób', '4 osoby', '6 osób', '3 osoby'),
  16. ('Cena', '30 zł', '40 zł', '20 zł'),
  17. ('Piętro', '1', '2', '1'),
  18. ('Telewizor', '', '', '');
  19. COMMIT;


  1. <html>
  2. <head>
  3. <meta name="viewport" content="width=device-width, initial-scale=1">
  4. <meta charset="utf-8">
  5. <title> Hotel Klimek</title>
  6.  
  7. <!-- PHP TU -->
  8. <body>
  9. <table>
  10. <thead>
  11. <tr>
  12. <th>&nbsp;</th>
  13. <th>Pokój nr 1</th>
  14. <th>Pokój nr 2</th>
  15. <th>Pokój nr 3</th>
  16. </tr>
  17. </thead>
  18.  
  19.  
  20. <?php
  21. $q1="select * from tabela";
  22. $run=mysqli_query($conn,$q1);
  23. while($row=mysqli_fetch_array($run))
  24. {
  25. $id=$row['id'];
  26. $room_1=$row['room_1'];
  27. $room_2=$row['room_2'];
  28. $room_3=$row['room_3'];
  29. ?>
  30.  
  31. <tr>
  32. <td width="10%" height="50px"><center><?php echo $id; ?></center></td>
  33. <td width="10%" height="50px"><center><?php echo $room_1; ?></center></td>
  34. <td width="10%" height="50px"><center><?php echo $room_2; ?></center></td>
  35. <td width="10%" height="50px"><center><?php echo $room_3; ?></center></td>
  36.  
  37. </tr>
  38.  
  39.  
  40. </table>
  41. </p>
  42. <?php
  43. }
  44. ?>
  45.  
  46. </body>
  47. </html>


1 wiersz ustawia się prawidłowo w poziomie, ale pozostałe są jeden pod drugim jak poniżej na ss.
Proszę o pomoc.

https://1drv.ms/u/s!ArWu9SCQhVIkgo1fOxF...Z-ITjg?e=LHWKHT
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 15.09.2025 - 14:10