将数组放入行和列中 [英] Echo array into rows and columns

查看:73
本文介绍了将数组放入行和列中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

拜托,帮帮我!





如何将缩略图回显到一行中的4列?喜欢这个:



1 2 3 4

5 6 7 8

9 10 11 12
....



这是我的代码:



Hi, please, help me!


How can I echo thumbnails into 4 columns ina row? Like this:

1 2 3 4
5 6 7 8
9 10 11 12
....

Here is my code:

echo "<table cellspacing=0 cellpadding=0 width='100%' border=0 align=center><tr>";
      if(mysql_num_rows($raw_results) > 0){ // if one or more rows are returned do following



          while($results = mysql_fetch_array($raw_results)){
          // $results = mysql_fetch_array($raw_results) puts data from database into array, while it's valid it does the loop



              echo "<td valign=top class='data' width='100'><a href='gname-photo.php?gal_id=$results[gal_id]'><img src='$path_thumbnail$results[img_name]'></a><br>$results[gname]</td>";
              // posts results gotten from database(title and text) you can also show id ($results['id'])

              echo "</tr></table>";

          }

      }

推荐答案

raw_results)> 0){ // 如果返回一行或多行,请执行以下操作



while(
raw_results) > 0){ // if one or more rows are returned do following while(


results = mysql_fetch_array(
results = mysql_fetch_array(


raw_results)){
//
raw_results)){ //


这篇关于将数组放入行和列中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆