doutuan9357 2014-05-28 15:32 采纳率: 100%
浏览 20
已采纳

如何确定while循环中tep_db_fetch_array的大小?

Can't get this. How to determine size of an tep_db_fetch_array inside a while loop?

I would like to do this:

$i=0;
while($a = tep_db_fetch_array($query)){
  if($i==5){
    // start a div i.e.
  }
  //do sth here
  if($i>=count($a)){ 
    //close the div i.e.   
  }
  $i++;       
}

but it is not working, because $a is not the whole array, just a pointer to the actual query result. What i am doing wrong, or how to do it?

  • 写回答

2条回答 默认 最新

  • dongliao1860 2014-05-28 16:13
    关注

    Try the function tep_db_num_rows, like this:

    $i=0;
    while($a = tep_db_fetch_array($query)){
      //do sth here
      if($i>=tep_db_num_rows($query)){ 
        //do sth other here for the last entry   
      }
      $i++;       
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 企业资源规划ERP沙盘模拟
  • ¥15 前端echarts坐标轴问题
  • ¥15 CMFCPropertyPage
  • ¥15 ad5933的I2C
  • ¥15 请问RTX4060的笔记本电脑可以训练yolov5模型吗?
  • ¥15 数学建模求思路及代码
  • ¥50 silvaco GaN HEMT有栅极场板的击穿电压仿真问题
  • ¥15 谁会P4语言啊,我想请教一下
  • ¥15 这个怎么改成直流激励源给加热电阻提供5a电流呀
  • ¥50 求解vmware的网络模式问题 别拿AI回答