dongwenhui8900 2010-12-04 07:09 采纳率: 0%
浏览 40
已采纳

如何回应每个4小时

  'products' => 
    array
      0 => 
        array
          'pid' => string '3' (length=1)
          'name' => string '#122232' (length=7)
          'information' => string 'DSDSD' (length=5)
          'image_tumb' => string '1tumbc4ad490017dc211002cfef359204ca7e154467_VisualVoicemail_Android_original.jpg' (length=80)
          'tag' => string 'Sepatu' (length=6)
          'price' => string '12000000.00' (length=11)
      1 => 
        array
          'pid' => string '4' (length=1)
          'name' => string 'Jam Bagus' (length=9)
          'information' => string 'DSDSD' (length=5)
          'image_tumb' => string '1tumbc4ad490017dc211002cfef359204ca7e_48447427_diaspora_dandy_logo.jpg' (length=70)
          'tag' => string 'Jam' (length=3)
          'price' => string '12000.00' (length=8)
      2 => 
        array
          'pid' => string '6' (length=1)
          'name' => string '#122232' (length=7)
          'information' => string 'awdwad' (length=6)
          'image_tumb' => string '1tumbc4ad490017dc211002cfef359204ca7e10408_710.jpg' (length=50)
          'tag' => string 'Sepatu' (length=6)
          'price' => string '140000.00' (length=9)

unlimited.

how do i display them like

name
name
name
name
<hr/>
name
name
name
name
<hr/>

or insert a hr after 4 times fetching ( currently useing PDO fecthall and foreach ) ?

         // displays name loops like "namenamenamenamenamenametounlimiteddata"
        foreach ($db['products'] as $product) {

            echo "<div id='product'>";
            echo $db[product][name];
            echo "</div>";
        }

but still no clue of doing the above. my friends say to use % sign in php? is that the best way ? if it is please give me an example how do it the right way, if there is a better way please describe it.

Thanks for looking in. Adam Ramadhan

  • 写回答

6条回答 默认 最新

  • doudi5291 2010-12-04 07:13
    关注
        $i = 1;
        foreach ($db['products'] as $product) {
            echo "<div id='product'>";
            echo $db[product][name];
            echo "</div>";
            if ($i % 4 == 0)
                  echo "<hr>";
            $i++;
        }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(5条)

报告相同问题?

悬赏问题

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