문제

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++;
}
도움이 되었습니까?

해결책

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

}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top