doujiaci7976 2010-07-12 05:42
浏览 21

动态行创建php和html

i want to make a table from a mysql query where the table should show like

pic1       pic2     pic3
name1      name2    name3
-------------------------
pic4       pic5     pic6
name4      name5    name6

please say how it is possible by using php and html?


ok,it will show picture and corresponding name,picture1 will be a picture same as pic2,pic3 etc,name1 is a name of corresponding as like orkut or face book,i have tried like code;-

for ($i = 0; $i < 2; $i++) {
    ?>
    <tr>
        <? for ($j = 0; $j < 3; $j++) {
            ?>

            <td>
                <table>
                    <tr>
                        <td align="left" valign="top"><a href="#"><img src="images/speak-pic.jpg" width="88" height="88"
                                                                       border="0" class="pic-bod"/></a></td>
                    </tr>
                    <tr>
                        <td align="left" valign="top"><a href="#" class="link-ar"><? echo $t["profile_name"]?>  </a>
                        </td>
                    </tr>
                </table>
            </td>



        <?
        }
        ?>
    </tr>
<?
}
  • 写回答

1条回答 默认 最新

  • doumi7854 2010-07-12 05:51
    关注

    First get the result from the query and loop it.

    // first make the connection..., then
    $sql = "SELECT xxxxxx";
    $result = mysql_query($sql);
    foreach($rs = mysql_fetch_assoc()) {
      // put the echo statement here with the apropriate html tags.
    }
    

    if you want to learn deep, catch this link from sitepoing.com http://articles.sitepoint.com/article/php-gallery-system-minutes

    评论

报告相同问题?

悬赏问题

  • ¥17 pro*C预编译“闪回查询”报错SCN不能识别
  • ¥15 微信会员卡接入微信支付商户号收款
  • ¥15 如何获取烟草零售终端数据
  • ¥15 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向