dongxianchu3541 2013-11-20 02:51
浏览 9
已采纳

oscommerce中的循环数组

I'm having trouble with a while loop that I'm trying to create within oscommerce. I'm trying to pull the 'secondary_id' from each row that has a product ID within the $products_array[$i]['id'] array, then store the secondary_id's in the $finddsid_query array. I'm trying to perform this function with the oscommerce database functions, but I can't seem to get it to fire. Any help or criticism would be greatly appreciated!

$array_size = count($products_array);
$finddsid_query = tep_db_query("select secondary_id from products where products_id = '" . $products_array[$i]['id'] . "'");
$i = 0;

while ($i <= $array_size - 1) {
    print_r( $finddsid_query[$i] );
    $i++;
}
  • 写回答

1条回答 默认 最新

  • dongruoqiong9017 2013-11-20 04:48
    关注
    $finddsid_arrray = array();
      foreach ($products_array as $value) {
        $finddsid_query = tep_db_query("select secondary_id from products where products_id = " . $value['id']);
        $finddsid = tep_db_fetch_array($finddsid_query);
          foreach ($finddsid as $pdsid) {
             $finddsid_arrray[] = array('dsid' => $pdsid['id']);
          }
    
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 vscode的问题提问
  • ¥50 切换TabTip键盘的输入法
  • ¥15 可否在不同线程中调用封装数据库操作的类
  • ¥15 微带串馈天线阵列每个阵元宽度计算
  • ¥15 keil的map文件中Image component sizes各项意思
  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
  • ¥15 划分vlan后,链路不通了?
  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 Centos / PETGEM