私はこれを解決することはできません。
複数の while があり、内部の 1 つは最初の結果のみを取得して停止します ...
コードは次のとおりです。
$categories は配列です
array(18) {
[0] => array(7) {
["category_id"] => string(1) "1"
["category_name"] => string(5) "pizza"
["category_display"] => string(5) "pizza"
["category_active"] => string(1) "1"
["category_parent"] => string(1) "0"
["category_position"] => string(1) "1"
["category_user_discount"] => string(2) "50"
}
[1] => array(7) {
["category_id"] => string(1) "2"
["category_name"] => string(4) "menu"
["category_display"] => string(4) "menu"
["category_active"] => string(1) "1"
["category_parent"] => string(1) "0"
["category_position"] => string(1) "2"
["category_user_discount"] => string(2) "30"
}
}
$stmt = $db->query("SELECT sell_id FROM sell WHERE sell.sell_status = 'close' AND sell_period_id >= '".$liste[0]."' AND sell_period_id <= '".$liste[1]."' ");
foreach ($categories as $cat)
{
while ($sell2 = $stmt->fetch())
{
$stmt2 = $this->db->query("SELECT * FROM sellcart WHERE sellcart_status = 'close' AND sellcart_sell_id = '".$sell2['sell_id']."' ");
while ($sellitem = $stmt2->fetch())
{
echo $sellitem['sellcart_item_category'];
}
}
}
最初のループは問題ありませんが、2 番目の $cat にはループしません ...
何か案が ?
ご協力いただきありがとうございます !!!