data = 0;
foreach(stories as sto){
if(data != sto['data']){
echo div
data = sto['data']
}
.....
}
$query_orders = mysql_query('SELECT ID,ORDER_ID,DATE_INSERT FROM `b_sale_basket` WHERE DATE_FORMAT(`DATE_INSERT`,\'%Y%c%e%H%i%s\')>'.mysql_real_escape_string($_GET['date']).'');
foreach($query_orders as $order) {
$orders_to_show[$order['ORDER_ID']] = $order;
$order_id[] = $order['ORDER_ID'];
}
$query_products = mysql_query('SELECT ID,ORDER_ID,NAME,QUANTITY,PRICE FROM `b_sale_basket` WHERE ORDER_ID IN ('.implode(',', $order_id).')');
foreach($query_products as $product) {
$orders_to_show[$product['ORDER_ID']]['products'][] = $product;
}
Array
(
[ID] => 14
[ORDER_ID] => 6
[PRICE] => 1259.1000
[DATE_INSERT] => 2015-10-29 11:40:14
[QUANTITY] => 1.0000
[NAME] => Нижнее белье Белая Свобода
)
Array
(
[ID] => 15
[ORDER_ID] => 6
[PRICE] => 2999.0000
[DATE_INSERT] => 2015-10-29 11:40:31
[QUANTITY] => 1.0000
[NAME] => Платье Весенняя Легкость
)