![]() |
![]() |
![]()
Post
#1
|
|
Grupa: Zarejestrowani Postów: 1 640 Pomógł: 28 Dołączył: 13.02.2003 Skąd: Międzyrzecz/Poznań Ostrzeżenie: (0%) ![]() ![]() |
W tabelce MySQL'a mam np. 9 rekordów i chcem je wyswietlic w nastepujacy sposób:
Kod 1 2 3 jak to zrobic?
4 5 6 7 8 9... Próbowałem z while() i for(), ale jakos sobie nie moge poradzic (IMG:http://forum.php.pl/style_emoticons/default/tongue.gif) |
|
|
![]() |
![]()
Post
#2
|
|
Grupa: Zarejestrowani Postów: 1 640 Pomógł: 28 Dołączył: 13.02.2003 Skąd: Międzyrzecz/Poznań Ostrzeżenie: (0%) ![]() ![]() |
Mam!! Pomogl mi nez z #phppl[php:1:7680cf6b9e]<?php
$result = mysql_query("select pole from $tabela"); $result2 = mysql_query("select count(pole) as ile from $tabela"); while($row2 = mysql_fetch_array($result2)) $ile = $row2['ile']; echo "<table><tr>"; $i = 1; while($row = mysql_fetch_array($result)){ if(($i % 3) == 0 && $i != $ile) echo"<td>".$row['pole']."</td></tr><tr>"; else if(($i % 3) == 0 || $i == $ile) echo"<td>".$row['pole']."</td></tr>"; else echo"<td>".$row['pole']."</td>"; $i++; } echo "</table>"; ?>[/php:1:7680cf6b9e] |
|
|
![]() ![]() |
![]() |
Aktualny czas: 10.10.2025 - 10:05 |