質問

私は、「DSID」に応じて、一連の製品を別々のアレイにグループ化するforeach関数を持っています。

$products_array = array();
$products_query = tep_db_query("select products_id, products_name, drop_ship_id from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . (int)$orders['orders_id'] . "' order by products_name");
while ($products = tep_db_fetch_array($products_query)) {
  $products_array[] = array('id' => $products['products_id'],
                            'text' => $products['products_name'],
            'dsid' => $products['drop_ship_id'],);
}

<?php
 $products = array();

  foreach($products_array as $current) {
    $dsid = $current['dsid'];
     $products[$dsid][] = $current; 
  }

 $splitproductsarray = array_values($products);
?>

次に、splitproductsArray []を取り、「DSID」の各グループをドロップシップメールで別のテーブルと比較する必要があります。

"select email from " . TABLE_DROP_SHIPPERS . " where id = splitproductsarray[]"

同じDSIDを持つ個々の製品グループに特定の電子メールを割り当てるにはどうすればよいですか?どんな助けも感謝します!

役に立ちましたか?

解決

いいかもしれません;)

これを試して:

foreach($splitproductsarray as $dsid => $values) {
    $sql = "select email from " . TABLE_DROP_SHIPPERS . " where id = " . $dsid . " LIMIT 1";
    // do your query
}

他のヒント

私はあなたが欲しいと思います

$all_ids=implode(',', $splitproductsarray);

"select email from " . TABLE_DROP_SHIPPERS . " where id IN =($all_ids)"
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top