dongzan7016 2014-09-22 09:01
浏览 73

使用numberous标签时限制每行的td

I'm trying to pull the if statements and put them into an array for a table where it will return a new row "" per every 5 results "image". Is it possible to use that with this functioning? The reason I have to use it like this is because the way Mybb is setup. It's either pull from a number of cells or try to sort out 1 cell with 25+ lines in it and no particular spacers...just everything crammed together. I've been testing a lot of different things out, but can get any to work. Every Google search comes up with something kind of related to my search but usually about different pages.

       $queryleader= mysql_query("SELECT * FROM pju_users WHERE `uid` = '1'") or die(mysql_error());
        while($dataleader = mysql_fetch_array($queryleader)){ 

        $queryfid = mysql_query("SELECT * FROM pju_userfields WHERE `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 IS THE PART I 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>";
                    }
                }
  • 写回答

2条回答 默认 最新

  • douhuan1950 2014-09-22 09:24
    关注

    Something like this might give you 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>";
    
    评论

报告相同问题?

悬赏问题

  • ¥15 关于#hadoop#的问题
  • ¥15 (标签-Python|关键词-socket)
  • ¥15 keil里为什么main.c定义的函数在it.c调用不了
  • ¥50 切换TabTip键盘的输入法
  • ¥15 可否在不同线程中调用封装数据库操作的类
  • ¥15 微带串馈天线阵列每个阵元宽度计算
  • ¥15 keil的map文件中Image component sizes各项意思
  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
  • ¥15 划分vlan后,链路不通了?
  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据