anonīms Posted March 7, 2008 Report Posted March 7, 2008 $i=0; $tabula = '<table>'; while($row = mysql_fetch_array($sql)){ if($i==0) { $tabula .= '<tr>'; } $tabula.= "<td><img src='http://eip.wc3.lv/images/flags/".$row['tautiba'].".gif' alt='' /> <a href='http://eip.wc3.lv/lietotajs/".$row['id']."' />".$row['lietotajvards']."</a></td>"; if($i==0) { $tabula .= '</tr>'; } $i = ($i+1) % 5; } $tabula .= '</table>'; echo $tabula; Kādēļ varētu būt tā, ka katrā aiznākamajā rindā ir tikai 1 ieraksts?
Aleksejs Posted March 7, 2008 Report Posted March 7, 2008 (edited) un ko rāda view source? Aha sapratu ;) Pēdējā pārbaudē vajag nevis: if($i==0) { $tabula .= '</tr>'; } bet gan: if($i==4) { $tabula .= '</tr>'; } Edited March 7, 2008 by Aleksejs
anonīms Posted March 7, 2008 Author Report Posted March 7, 2008 (edited) Jap :] Paldies Edited March 7, 2008 by anonīms
andrisp Posted March 7, 2008 Report Posted March 7, 2008 Tak neķēpājieties ar tabulām :) #list li { float: left; width: 33.3%; list-style-type: none; margin: 0; padding: 0; } <ul id="list"> cikls { echo '<li>ljalja</li>'; } </ul>
Recommended Posts