Joyride Posted October 18, 2006 Report Share Posted October 18, 2006 Sveiki! Nekadi nevaru izdomat, ka lai attelo info no datubazes rindas, pa 2 katra: 1 kautkas | 2 kautkas 3 kautkas | 4 kautkas utt | utt $res = mysql_query("SELECT * FROM tabula"); echo '<table>'; while($row = mysql_fetch_assoc($res)) { // ...? } echo '</table>'; Vai kads nevaretu pateikt prieksa Link to comment Share on other sites More sharing options...
litt Posted October 18, 2006 Report Share Posted October 18, 2006 Vai tiešām tik grūti izdomāt veidu kā to noteikt? Elementāra matemātika Link to comment Share on other sites More sharing options...
Delfins Posted October 18, 2006 Report Share Posted October 18, 2006 Mūsdienu jaunie koderi māk tikai nokopēt kodu no PHP_SoliPaSolim Link to comment Share on other sites More sharing options...
Joyride Posted October 18, 2006 Author Report Share Posted October 18, 2006 Nu nevaru izdomat es! Nejautatu, ja zinatu ka... Link to comment Share on other sites More sharing options...
Blitz Posted October 18, 2006 Report Share Posted October 18, 2006 (edited) dosu paris elementus kas jaizmanto, talak doma pac! 1) $count=0; 2) $count++; 3) if ($count==2) 4) echo "</tr><tr>"; Edited October 18, 2006 by Blitz Link to comment Share on other sites More sharing options...
Joyride Posted October 18, 2006 Author Report Share Posted October 18, 2006 Tnx, ideja ir skaidra! Link to comment Share on other sites More sharing options...
v3rb0 Posted October 18, 2006 Report Share Posted October 18, 2006 tikai pirmais/otrais - nevajag nekādu tur $count. pietiek ar parastu booleanu. $is_first = true; while($row = mysql_fetch_assoc($res)) { if($is_first) { // primais } else { // otrais' } $is_first = !$is_first; } Link to comment Share on other sites More sharing options...
Recommended Posts