duancong2160 2015-11-09 14:34
浏览 20
已采纳

表重复区域

I am pulling two different variables from the database. A name, and an image path. I want to display this on the page to look like this:

|Image 1|Image 2|Image 3|

|Name 1 |Name 2 |Name 3 |

I currently have this code:

<?php do { ?>
<img src="<?php echo $row_UserInfo['image_path'];?>" width="150" height="150"/>
<a href="HorseProfile.php?recordID=<?php echo $row_UserInfo['id']; ?>"style="color:#000000; text-decoration: none; text-align: center;">
<?php echo $row_UserInfo['Name']?></a>
<?php } while ($row_UserInfo = mysql_fetch_assoc($UserInfo)); ?>

I tried to add a break after the image so that the name goes right under it, but then when the next image appears, it goes next to the name before. I know this is probably extremely simple, but this has been a problem for me for a while and if someone could open my eyes and show me what I'm doing wrong, that would be deeply appreciated.

  • 写回答

1条回答 默认 最新

  • dongshedan4672 2015-11-09 14:41
    关注

    You should enclose your image and link in a div, and then float the div. Here is an example:

    <?php do { ?>
        <div style="float:left;">
            <div>
                <img src="<?php echo $row_UserInfo['image_path'];?>" width="150" height="150"/>
            </div>
            <div>
                <a href="HorseProfile.php?recordID=<?php echo $row_UserInfo['id']; ?>"style="color:#000000; text-decoration: none; text-align: center;">
                    <?php echo $row_UserInfo['Name']?>
                </a>
            </div>
        </div>
    <?php } while ($row_UserInfo = mysql_fetch_assoc($UserInfo)); ?>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么