![]() |
![]() |
![]()
Post
#1
|
|
Grupa: Zarejestrowani Postów: 134 Pomógł: 4 Dołączył: 16.02.2007 Skąd: Leszno Ostrzeżenie: (20%) ![]() ![]() |
Witam,
mam mały problem z pętlą. Napisałem kod:
Baza Danych: Kod -- -- Struktura tabeli dla `pokoj_1` -- CREATE TABLE `pokoj_1` ( `id` int(11) NOT NULL auto_increment, `do_dd` text, `do_mm` text, `do_rr` text, `z_dd` text, `z_mm` text, `z_rr` text, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin2 AUTO_INCREMENT=3; -- -- Zrzut danych tabeli `pokoj_1` -- INSERT INTO `pokoj_1` (`id`, `do_dd`, `do_mm`, `do_rr`, `z_dd`, `z_mm`, `z_rr`) VALUES(1, '11', '02', '2009', '13', '02', '2009'), (2, '14', '02', '2009', '15', '02', '2009'); -- -------------------------------------------------------- -- -- Struktura tabeli dla `pokoj_2` -- CREATE TABLE `pokoj_2` ( `id` int(11) NOT NULL auto_increment, `do_dd` text, `do_mm` text, `do_rr` text, `z_dd` text, `z_mm` text, `z_rr` text, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin2 AUTO_INCREMENT=3; -- -- Zrzut danych tabeli `pokoj_2` -- INSERT INTO `pokoj_2` (`id`, `do_dd`, `do_mm`, `do_rr`, `z_dd`, `z_mm`, `z_rr`) VALUES (1, '11', '08', '2009', '13', '08', '2009'), (2, '14', '08', '2009', '15', '08', '2009'); -- -------------------------------------------------------- -- -- Struktura tabeli dla `pokoj_3` -- CREATE TABLE `pokoj_3` ( `id` int(11) NOT NULL auto_increment, `do_dd` text, `do_mm` text, `do_rr` text, `z_dd` text, `z_mm` text, `z_rr` text, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin2 AUTO_INCREMENT=3; -- -- Zrzut danych tabeli `pokoj_3` -- INSERT INTO `pokoj_3` (`id`, `do_dd`, `do_mm`, `do_rr`, `z_dd`, `z_mm`, `z_rr`) VALUES (1, '11', '02', '2009', '13', '02', '2009'), (2, '14', '02', '2009', '15', '02', '2009'); Pętla wyświetla mi: Kod Rezerwacja pokoju 1 Pokój 1 zajęty Rezerwacja pokoju 2 Rezerwacja pokoju 2 Rezerwacja pokoju 3 Pokój 3 zajęty Chodzi mi o to że jeśli dane istnieją w tabeli obojętnie pod jakim ID to żeby nie wyświetlało mi tyle razy ile jest ID w bazie tylko raz o to co jest w zapytaniu: Kod Pokój 1 zajęty
Rezerwacja pokoju 2 Pokój 3 zajęty |
|
|
![]() ![]() |
![]() |
Aktualny czas: 23.08.2025 - 10:33 |