vitao.web Posted December 6, 2010 Report Share Posted December 6, 2010 Labdien! Jautājums, vai ir iespējams bez javascript un citiem palīgi izdarīt tā ka parādot no datu bāzes ierakstus tabulas veidā piemēram pirmā rinda ir sarkana , bet otrā zaļa un tad atkal 3 rinda sarkana? Skatījos tabulu paraugus googlē, bet tur tik dod tos <table> piemērus, kas man nepatīk pārāk. Paldies! Quote Link to comment Share on other sites More sharing options...
Kemito Posted December 6, 2010 Report Share Posted December 6, 2010 (edited) Atbildot uz tavu jautājumu - Jā, var ! Papildinu: $i = 1 while(){ if($i&1){$color = "krāsa"}else{$color="krāsa"} $i++ } Attiecīgi norādi: <tr bgcolor="'.$color.'"></tr> Protams iekš PHP ! Edited December 6, 2010 by Kemito Quote Link to comment Share on other sites More sharing options...
vitao.web Posted December 6, 2010 Author Report Share Posted December 6, 2010 Paldies kemito! Pārbaudīšu, bet vajadzētu būt labi :) Quote Link to comment Share on other sites More sharing options...
briedis Posted December 6, 2010 Report Share Posted December 6, 2010 Google - zebra row Quote Link to comment Share on other sites More sharing options...
vitao.web Posted December 6, 2010 Author Report Share Posted December 6, 2010 Google - zebra row Nu tā nebiju iedomājies pameklēt! Bet Paldies! Uzreiz daudzi paraugi :) Quote Link to comment Share on other sites More sharing options...
Roberts.R Posted December 6, 2010 Report Share Posted December 6, 2010 Es kādreiz izmantoju šadu variantu: $i = 0; $num++; $even = $num % 2; $even == 1 ? 'red':'green'; Attiecīgi <tr class="<?=$even?>"></tr> Quote Link to comment Share on other sites More sharing options...
vitao.web Posted December 6, 2010 Author Report Share Posted December 6, 2010 (edited) $i = 0; $klase = $i++%2==1 ? 'red' : 'green'; // Parādu ar <div class='".$klase."'> Problēma ir tāda ka visi ieraksti ir zali :( Kur kluda? jo pec idejas visiem nevienadajiem cipariem vajadzetu but zaliem. Vai varat paskaidrot, ko es nepareizi esmu izdarījis? Edited December 6, 2010 by vitao.web Quote Link to comment Share on other sites More sharing options...
Val Posted December 6, 2010 Report Share Posted December 6, 2010 Cikls vispār ir? Minēšu, ka esi vēl vienu lieku $i++ pielicis. Quote Link to comment Share on other sites More sharing options...
vitao.web Posted December 6, 2010 Author Report Share Posted December 6, 2010 dbConnect(); $i = 0; $klase = $i++%2==1 ? 'even' : 'odd'; $izs = dbFetch("select * from blog order by id DESC LIMIT 8"); while($rez = mysql_fetch_assoc($izs)){ echo " <div class='".$klase."'> <div class='table_title'>".$rez['title']."</div> <div class='table_date'>".$rez['date']."</div> <div class='table_message'>".$rez['message']."</div> <div class='clear'></div><br /> </div>"; } dbDisconect();?> Quote Link to comment Share on other sites More sharing options...
rATRIJS Posted December 6, 2010 Report Share Posted December 6, 2010 $klase = $i++%2==1 ? 'even' : 'odd'; ir jaaliek ieksh cikla. Quote Link to comment Share on other sites More sharing options...
vitao.web Posted December 6, 2010 Author Report Share Posted December 6, 2010 Vai vari paskaidrot, ka to izdarīt? Loop = cikls? Quote Link to comment Share on other sites More sharing options...
rATRIJS Posted December 6, 2010 Report Share Posted December 6, 2010 http://translate.google.lv/translate?js=n&prev=_t&hl=lv&ie=UTF-8&layout=2&eotf=1&sl=en&tl=lv&u=http://php.net/manual/en/control-structures.while.php Quote Link to comment Share on other sites More sharing options...
vitao.web Posted December 6, 2010 Author Report Share Posted December 6, 2010 http://translate.google.lv/translate?js=n&prev=_t&hl=lv&ie=UTF-8&layout=2&eotf=1&sl=en&tl=lv&u=http://php.net/manual/en/control-structures.while.php Paldies! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.