Answer the question
In order to leave comments, you need to log in
How to make entries for each line?
Hello, I was breaking my head with the possibility of recording, but I didn’t find an answer, tell me how to do it right? There is a php file that, with the value of a certain database table, selects and updates another table.
<?
$db->Query("SELECT * FROM db_config WHERE id = '1' LIMIT 1");
$setup_site = $db->FetchArray();
$new_refresh = time() + 60*60*1/20; //время рефреша (сейчас 3 минуты)
$refresh = time();
$db->Query("SELECT * FROM db_refresh WHERE id = '1' LIMIT 1");
$base = $db->FetchArray();
if(($base["timer"]) < $refresh){
$db->Query("SELECT user FROM db_users_b WHERE workmens1 >= '1'");
$spisok = $db->FetchArray();
// расчет суммы вычета
$sum_pay = ((($spisok["workmens1"]) * ($setup_site["price_workmens1"])) + (($spisok["workmens2"]) * ($setup_site["price_workmens2"])) + (($spisok["workmens3"]) * ($setup_site["price_workmens3"])) + (($spisok["workmens4"]) * ($setup_site["price_workmens4"])) + (($spisok["workmens5"]) * ($setup_site["price_workmens5"])));
$db->Query("UPDATE db_users_b SET money_p = money_p - $sum_pay WHERE workmens1 >= '1'");
$db->Query("INSERT INTO db_refresh (timer) VALUES ('$new_refresh')");
return;
}
?>
Answer the question
In order to leave comments, you need to log in
I didn't quite understand what was needed.
Query a cell from another table. It?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question