Psycke Posted October 9, 2007 Report Share Posted October 9, 2007 http://paste.php.lv/6215 Tur ir mans kodiņš un visu laiku viņš vienkārši vilka ārā visu vienā krāsā, bet tagad sagribējās dažādību un noderētu skripts, kurš katru otro rowu krāso citā krāsā. Varētu kāds lūdzu izpalīdzēt? Iekš php ar 'for' esmu nulle. Link to comment Share on other sites More sharing options...
Vebers Posted October 9, 2007 Report Share Posted October 9, 2007 (edited) $i = 0; while($row = mysql_fetch_array($result)) { $admins = $row['admin_nick']; $skaits = $row['count(*)']; if(($i % 2) == 0) { echo '<tr style="color: #ccc;">'; } else { echo '<tr>'; } echo " <td>$admins</td> <td>$skaits</td> </tr>"; $i++; } Edited October 9, 2007 by MakaTaNaw Link to comment Share on other sites More sharing options...
martins256 Posted October 9, 2007 Report Share Posted October 9, 2007 (edited) man liekas, ka šitā ietu! $i=0; while($row = mysql_fetch_array($result)) { $i++; if($i % 2 == 0) $kraasa = 'red'; else $kraasa = 'green'; $admins = $row['admin_nick']; $skaits = $row['count(*)']; echo "<tr style='color:$kraasa'> <td>$admins</td> <td>$skaits</td> </tr>"; } MakaTaNaw jau pasteidzās :D Edited October 9, 2007 by martins256 Link to comment Share on other sites More sharing options...
Kristabs Posted October 9, 2007 Report Share Posted October 9, 2007 (edited) http://paste.php.lv/6217 Upd. :D Veseli trīs reizē, nav slikti. Edited October 9, 2007 by Kristabs Link to comment Share on other sites More sharing options...
Grey_Wolf Posted October 9, 2007 Report Share Posted October 9, 2007 esmu nulle. preciizi teikts jo Latviski lasiit arii nemaaki :( te paskatiities protams bija slinkums nu jaa un atrast rindinu rindu krāsošana tabulā (katra otrā citā krāsā) arii bija pilniigi neiespejami :( Link to comment Share on other sites More sharing options...
KAC Posted October 9, 2007 Report Share Posted October 9, 2007 Var arī ar js + css Link to comment Share on other sites More sharing options...
Psycke Posted October 9, 2007 Author Report Share Posted October 9, 2007 Ļoti atvainojos, sen nebiju te rādījies biju piemirsis, ka biežāk jautātais jau ir atbildēts reizes 1000. Apskatījos un visu ja uesmu sataisījis, tiešām ļoti atvainojos par savu glupo jautājumu. Un tieši, kad izlaboju jau domāju, ka kāds te to būs ierasktījis, un tiešām, Grey_Wolf to ir izdarījis. Link to comment Share on other sites More sharing options...
Recommended Posts