Сообщество IT-специалистов
Ответы на любые вопросы об IT
Профессиональное развитие в IT
Удаленная работа для IT-специалистов
foreach($user_input_query as $massiv) { foreach ($massiv as $value) { echo '<pre>'; var_dump($value); echo '</pre>'; } }
echo '<pre>'; var_dump($user_input_query); echo '</pre>';
$sqlQuery = ' SELECT `users`, SUM(`vklad`) AS `sum_vklad`, SUM(TIMESTAMPDIFF(DAY, `date`, CURDATE())) AS `sum_date_diff` FROM tablename; ';
foreach($user_input_query as $massiv) { echo '<pre>'; var_dump($massiv['sum_date_diff']); echo '</pre>'; }
if( isset($data['management_a_scam']) ) { $data_id = $data['management_a_id']; $data_url = $data['management_a_url']; $data_url = $data['management_a_url']; $user_input_query = mysqli_query($CONNECT, "SELECT `users` AS name_user, sum(`vklad`) AS sum_vklad, sum(TIMESTAMPDIFF(DAY, `date`, CURDATE())) AS `sum_date_diff` FROM `refback` WHERE `moderation` = 'off' AND `status` = 'on' AND `url` = '$data_url' GROUP BY `users`"); foreach($user_input as $massiv) { $derived_from_game = (($massiv['sum_vklad']*29/30)/100)*$massiv['sum_date_diff']; #Подсчитываем вывод с игры пользователем за N-ый промежуток времени $amount_loss_user = $massiv['sum_vklad']-$derived_from_game; #Подсчитываем сумму убытока пользователя if ($amount_loss_user > 0) { $insurance = R::dispense('insurance'); $insurance->games = $data['management_a_name']; $insurance->hash = $data['management_a_id']; $insurance->users = $massiv['name_user']; $insurance->loss = number_format($amount_loss_user, 2, '.', ''); $insurance->to_accrual = number_format(0, 2, '.', ''); R::store($insurance); $data_ID = $data['management_a_id']; $insurance_total_summ_query = mysqli_query($CONNECT, "SELECT sum(`loss`) FROM `insurance` WHERE `hash` = '$data_ID'"); $insurance_total_summ = mysqli_fetch_array($insurance_total_summ_query); $calc_insurance = ($data['management_a_insurance']/$insurance_total_summ[0] )*$amount_loss_user; $insurance_user_update = $massiv['name_user']; $insurance_update = mysqli_query($CONNECT, "UPDATE `insurance` SET `to_accrual` = '$calc_insurance' WHERE `users` = '$insurance_user_update' AND `hash` = '$data_ID'"); mysqli_query($CONNECT, "UPDATE `users` SET `balance` = `balance` + '$calc_insurance' WHERE `login` = '$insurance_user_update'"); } } $other = mysqli_query($CONNECT, "UPDATE `games` SET `scam` = 'on' WHERE `id`='$data_id'"); mysqli_query($CONNECT, "UPDATE `refback` SET `status` = 'off' WHERE `url`='$data_url'"); }
$insurance_update = mysqli_query($CONNECT, "UPDATE `insurance` SET `to_accrual` = '$calc_insurance' WHERE `users` = '$insurance_user_update' AND `hash` = '$data_ID'"); mysqli_query($CONNECT, "UPDATE `users` SET `balance` = `balance` + '$calc_insurance' WHERE `login` = '$insurance_user_update'");
echo '<pre>'; var_dump($calc_insurance); echo '<br />'; var_dump($insurance_user_update); echo '<br />'; var_dump($data_ID); echo '<br />'; echo '</pre>';