Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> jak wyswietlic rekordy w okreslony sposob?
yesir
post 19.06.2004, 21:28:27
Post #1





Grupa: Zarejestrowani
Postów: 11
Pomógł: 0
Dołączył: 2.09.2002

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


Witam

Mam w bazie sql tabele, w ktorej znajduja sie imiona.
nie wiem jak zrobic zeby imiona byly wyswietlane w przegladarce wedlug takiego schematu.

marek kinga ola
krysia ewa romek

Jak robie tabele w html to imiona wysiwetlaja mi sie albo pionowo albo poziomo. Nigdy w trzech kolumnach po dwa.

Ktos moze mnie naprowadzic?
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 5)
kicaj
post 19.06.2004, 21:49:37
Post #2





Grupa: Zarejestrowani
Postów: 1 640
Pomógł: 28
Dołączył: 13.02.2003
Skąd: Międzyrzecz/Poznań

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


poczytaj o znaczku "modulo" (czy jakos tak)

W ogole to juz bylo na forum smile.gif


--------------------
PHP Developer

"Nadmiar wiedzy jest równie szkodliwy jak jej brak" Émile Zola
Go to the top of the page
+Quote Post
bregovic
post 19.06.2004, 21:50:56
Post #3





Grupa: Zarejestrowani
Postów: 562
Pomógł: 15
Dołączył: 8.08.2003
Skąd: Denmark/Odense

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


zakladajac ze wyswietlasz uzywajac konstrukcji while" title="Zobacz w manualu PHP" target="_manual:

  1. <?php
  2. print '<table>';
  3. $i=0;
  4. while ($result = mysql_fetch_array)
  5. {
  6.  $i++;
  7.  if ($i%= 0) { print '<tr>'; }
  8.  print '<td>'.$result['imie'].'</td>';
  9.  if ($i%= 0) { print '</tr>'; }
  10. }
  11. print '</table>';
  12. ?>


chyba powinno byc ok. sprawdz.


--------------------
Prank - for the fun. Mac - for the simplicity. Deviantart - for the kick.
Life is ours, We live it our way -- Metallica
Go to the top of the page
+Quote Post
yesir
post 20.06.2004, 16:42:01
Post #4





Grupa: Zarejestrowani
Postów: 11
Pomógł: 0
Dołączył: 2.09.2002

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


Cos nie za bradzo chce mi dzialac.

moze cos zle robie, zrobilem to tak:

  1. <?
  2. require (&#092;"newsconfig.inc\");
  3. mysql_connect($bb_news_hostname,$bb_news_mysqluser,$bb_news_mysqlpassword)
  4.                or die(&#092;"Unable to connect to SQL server\");
  5.  
  6. $query = &#092;"select nr, imie from imiona order by nr desc limit 3\";   
  7.  
  8. $news =  mysql_db_query($bb_news_db, $query) or die(&#092;"Select Failed!\");
  9.  
  10. print '<table>';
  11. $i=0;
  12. while ($row = mysql_fetch_array($news)) {
  13.  
  14. ?><? 
  15. $i++;
  16. if ($i%= 0) { print '<tr>'; }
  17. print '<td><? echo $bb_news_imie_fn; ?></td>';
  18. if ($i%3 = 0) { print '</tr>'; }
  19.  
  20. ?>        
  21. <? } ?><? print '</table>'; ?>


Albo czy ktos moze podac linki do podobnych postow bo takowych nie znalazlem

Ten post edytował yesir 20.06.2004, 16:50:11
Go to the top of the page
+Quote Post
stoprocent
post 20.06.2004, 16:51:57
Post #5





Grupa: Zarejestrowani
Postów: 338
Pomógł: 2
Dołączył: 17.05.2003
Skąd: Kraków , Londyn

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


  1. <?
  2. require (&#092;"newsconfig.inc\");
  3. mysql_connect($bb_news_hostname,$bb_news_mysqluser,$bb_news_mysqlpassword)
  4.                or die(&#092;"Unable to connect to SQL server\");
  5.  
  6. $query = &#092;"select nr, imie from imiona order by nr desc limit 3\";   
  7.  
  8. $news =  mysql_db_query($bb_news_db, $query) or die(&#092;"Select Failed!\");
  9.  
  10. print '<table>';
  11. $i=0;
  12. while ($row = mysql_fetch_array($news)) {
  13.  
  14. $i++;
  15. if (($i % 3) == 0) { print '<tr>'; } // 2x znak rownosci
  16. print '<td>'.$zienna_z_imieniem.'</td>';
  17. if (($i % 3) ==0) { print '</tr>'; }// 2x znak rownosci
  18.  
  19. }
  20. print '</table>'; ?>


Ten post edytował nasto 20.06.2004, 16:55:50


--------------------
Go to the top of the page
+Quote Post
yesir
post 20.06.2004, 17:23:09
Post #6





Grupa: Zarejestrowani
Postów: 11
Pomógł: 0
Dołączył: 2.09.2002

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


Dziala exclamation.gif!

Bardzo dziekuje...
Go to the top of the page
+Quote Post

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

 



RSS Wersja Lo-Fi Aktualny czas: 21.06.2025 - 19:52