oscommerce中的循环数组

时间:2013-11-20 02:51:51

标签: php arrays while-loop oscommerce

我正在尝试在oscommerce中创建一个while循环。我试图从$ products_array [$ i] ['id']数组中的产品ID的每一行拉出'secondary_id',然后将secondary_id存储在$ finddsid_query数组中。我正在尝试使用oscommerce数据库函数执行此功能,但我似乎无法解决它。任何帮助或批评将不胜感激!

$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 个答案:

答案 0 :(得分:0)

$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']);
      }

}