php - limit td's per row using while using numberous if tags -


i'm trying pull if statements , put them array table return new row "" per every 5 results "image". possible use functioning? reason have use because way mybb setup. it's either pull number of cells or try sort out 1 cell 25+ lines in , no particular spacers...just crammed together. i've been testing lot of different things out, can work. every google search comes kind of related search different pages.

       $queryleader= mysql_query("select * pju_users `uid` = '1'") or die(mysql_error());         while($dataleader = mysql_fetch_array($queryleader)){           $queryfid = mysql_query("select * pju_userfields `ufid` = '".$dataleader['uid']."'") or die(mysql_error());         while($dataufid = mysql_fetch_array($queryfid)){         echo "<tr>";          if ($dataleader['avatar'] == ""){             echo "<td><img src='images/default_member.png' height='50' width='50' title='" . $dataleader['username'] . "''/></td>";             }else{         echo "<td><img src='uploads/avatars/avatar_" . $dataleader['uid'] . ".jpg' height='50' width='50' title='" . $dataleader['username'] . "''/></td>";         }         echo '<td align="left">';         echo "<div style='margin:0; padding:0; font-family:arial,helvetica,sans-serif'><font size='3'>.god|" . $dataleader["username"] . "</font><br /><font size='1'>&nbsp;&nbsp;founder</font></div>";         echo '</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>';         echo "<td align='center'><img src='images/flags/" . $dataufid['fid1'] . ".png' title='" . $dataufid['fid1'] . "'></td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>";                if ($dataleader['away'] == "1"){             echo '<td align="center"><font color="#9d0000">inactive</font></td> ';             }             elseif ($dataleader['away'] == "0"){         echo '<td align="center"><font color="#219b00">active</font></td>';                         }                    if ($dataufid['fid5'] != null) {                 echo "<td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td align='center'><a href='http://steamcommunity.com/id/" . $dataufid['fid5'] . "'>" . $dataleader["username"] . "</a></td>";                 }elseif ($dataufid['fid8'] != null) {          echo "<td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td align='center'><a href='http://steamcommunity.com/profiles/" . $dataufid['fid8'] . "'>" . $dataleader["username"] . "</a></td>";          }else{          echo "<td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td></td>";          }      echo "<td><table><tr>";  //////////////////////////////////////////// //                                        // //                                        // //this part need post 5 per row  // //                                        // //                                        // ////////////////////////////////////////////                //americas army              if ($dataufid['fid9'] == "yes") {                 echo '<td><img src="images/games/aa.png" title="americas army"/></td>';                 }             //arma 2               if ($dataufid['fid10'] == "yes") {                 echo '<td><img src="images/games/arma2.png" title="arma 2"/></td>';                 }             //arma 3               if ($dataufid['fid11'] == "yes") {                 echo '<td><img src="images/games/arma3.png" title="arma 3"/></td>';                 }             //breaking point               if ($dataufid['fid12'] == "yes") {                 echo '<td><img src="images/games/bp.png" title="breaking point"/></td>';                 }             //battleroyal               if ($dataufid['fid13'] == "yes") {                 echo '<td><img src="images/games/br.png" title="battleroyal"/></td>';                 }              //bf3                if ($dataufid['fid14'] == "yes") {                 echo '<td><img src="images/games/bf3.png" title="battlefield 3"/></td>';                 }             //bf4               if ($dataufid['fid15'] == "yes") {                 echo '<td><img src="images/games/bf4.png" title="battlefield 4"/></td>';                 }             //borderlands 1               if ($dataufid['fid16'] == "yes") {                 echo '<td><img src="images/games/borderlands.png" title="borderlands"/></td>';                 }             //borderlands 2               if ($dataufid['fid17'] == "yes") {                 echo '<td><img src="images/games/borderlands2.png" title="borderlands 2"/></td>';                 }             //cod:mw               if ($dataufid['fid18'] == "yes") {                 echo '<td><img src="images/games/cod_mw.png" title="cod modern warfare"/></td>';                 }             //cod:mw2               if ($dataufid['fid19'] == "yes") {                 echo '<td><img src="images/games/cod_mw2.png" title="cod modern warfare2"/></td>';                 }              //cod:mw3               if ($dataufid['fid20'] == "yes") {                 echo '<td><img src="images/games/cod_mw3.png" title="cod modern warfare3"/></td>';                 }               //cod:bo               if ($dataufid['fid21'] == "yes") {                 echo '<td><img src="images/games/cod_bo.png" title="cod black ops"/></td>';                 }              //cod:bo2               if ($dataufid['fid22'] == "yes") {                 echo '<td><img src="images/games/cod_bo2.png" title="cod black ops 2"/></td>';                 }              //cod:ghost               if ($dataufid['fid23'] == "yes") {                 echo '<td><img src="images/games/cod_ghosts.png" title="cod ghosts"/></td>';                 }                //cod:aw               if ($dataufid['fid24'] == "yes") {                 echo '<td><img src="images/games/aw.png" title="cod advanced warfare"/></td>';                 }                //deadisland               if ($dataufid['fid25'] == "yes") {                 echo '<td><img src="images/games/deadisland.png" title="dead island"/></td>';                 }                   //cod:league of legends               if ($dataufid['fid26'] == "yes") {                 echo '<td><img src="images/games/lol.png" title="league of legends"/></td>';                 }                 //cs               if ($dataufid['fid27'] == "yes") {                 echo '<td><img src="images/games/cs.png" title="counterstrike"/></td>';                 }                   //cs-go               if ($dataufid['fid28'] == "yes") {                 echo '<td><img src="images/games/cs_go.png" title="counterstrike:go"/></td>';                 }                  //dayz               if ($dataufid['fid29'] == "yes") {                 echo '<td><img src="images/games/dayz.png" title="dayz"/></td>';                 }                  //l4d               if ($dataufid['fid30'] == "yes") {                 echo '<td><img src="images/games/l4d.png" title="left 4 dead"/></td>';                 }                  //l4d2               if ($dataufid['fid31'] == "yes") {                 echo '<td><img src="images/games/l4d2.png" title="left 4 dead 2"/></td>';                 }                  //starcraft               if ($dataufid['fid32'] == "yes") {                 echo '<td><img src="images/games/starcraft.png" title="starcraft"/></td>';                 }                  //starcraft               if ($dataufid['fid33'] == "yes") {                 echo '<td><img src="images/games/starcraft2.png" title="starcraft 2"/></td>';                 }              echo "</table></td></tr>";                     }                 } 

something might give better idea =

<?php $a = array('a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a'); echo "<table>"; echo "<tr>"; for($i = 1; $i <= sizeof($a); $i++) {     echo "<td>".$a[$i-1]."</td>";     if($i % 5 == 0)     {         echo "</tr><tr>";     } } echo "</tr>"; echo "</table>"; 

Comments

Popular posts from this blog

php - Submit Form Data without Reloading page -

linux - Rails running on virtual machine in Windows -

php - $params->set Array between square bracket -