Как реализовать данный вывод?
Как реализовать список юзерлистов из $result по ID из БД в цикле while из БД или по другому как? Я не представляю, голова запуталась. Пишу впервые по маленькому. Подробности в коде и комментариях.
<?php
define( 'DATALIFEENGINE', true );
#if(defined('DATALIFEENGINE'))die("Hacking attempt!"); // accept
include $_SERVER['DOCUMENT_ROOT'] . '/engine/data/config.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/engine/classes/mysql.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/engine/data/dbconfig.php';
$dle_billing = $db->query("SELECT * FROM dle_billing_invoice WHERE invoice_date_pay NOT LIKE '0'");
$dle_billing_api = [];
while ($dle_billing_json = $db->get_row($dle_billing)) {
$dle_billing_api[] = [
'user_username' => $dle_billing_json['invoice_user_name'],
'user_price_pay' => $dle_billing_json['invoice_get'],
'user_id_news' => $dle_billing_json['invoice_id_news'],
'user_prefix' => 'm',
'user_number_content' => $dle_billing_json['seria']
];
}
$dle_billing_api = array_replace($dle_billing_api, array_fill_keys(array_keys($dle_billing_api, null), ""));
$dle_billing_api_1 = json_decode(file_get_contents('https://site/api/pay.subtitle.php'), true);
$result = [];
foreach ($dle_billing_api as $key_1 => $value_1) {
foreach ($dle_billing_api_1 as $key_2 => $value_2) {
$result[] = $value_1;
$result[] = $value_2;
break;
}
}
print_r($result); // это список юзеров
/* В $result список юзеров
Array
(
[0] => Array
(
[user_username] => 111111
[user_price_pay] => 350.00
[user_id_news] => 1
[user_prefix] => m
[user_number_content] => 1
)
[1] => Array
(
[user_username] => support
[user_price_pay] => 35.00
[user_id_news] => 1
[user_prefix] => n
[user_number_content] => 1
)
[2] => Array
(
[user_username] => Spy
[user_price_pay] => 50.00
[user_id_news] => 1
[user_prefix] => m
[user_number_content] => 1
)
[3] => Array
(
[user_username] => support
[user_price_pay] => 35.00
[user_id_news] => 1
[user_prefix] => n
[user_number_content] => 1
)
[4] => Array
(
[user_username] => Dynamomag
[user_price_pay] => 200.00
[user_id_news] => 2
[user_prefix] => m
[user_number_content] => 1
)
[5] => Array
(
[user_username] => support
[user_price_pay] => 35.00
[user_id_news] => 1
[user_prefix] => n
[user_number_content] => 1
)
)
*/
$dle_bank_post = $db->query("SELECT * FROM dle_price_subtitle");
while ($dle_bank = $db->get_row($dle_bank_post)) {
/* В самом $dle_bank
Array
(
[id] => 1
[price] => 400
[kinopoisk] => 1108690
[id_post_news_m] => 5728
[id_post_news_n] => 5847
[count] => 9
[date] => 2020-12-24 14:00:00
[status] => 1
)
Array
(
[id] => 2
[price] => 700
[kinopoisk] => 1345717
[id_post_news_m] =>
[id_post_news_n] =>
[count] => 1
[date] => 2020-12-28 00:00:00
[status] => 1
)
*/
# ВАЖНО!
// Нужно вывести все новости с списками юзеров по определенной новости
// Например 1 новость имеет список юзеров с $result по логике и так по циклу
// Не надо так 1 новость 1 юзер (а надо 1 новость - *number* юзеров, зависит сколько в массиве).
}
?>