A
A
Arthur2016-01-25 00:35:43
PHP
Arthur, 2016-01-25 00:35:43

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;
}
?>

The catch is that the update should be with a backing track for each line, because the number of workmen is different for everyone, move on the right path.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Z
Zakhar Storozhuk, 2016-01-25
@Phell

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 question

Ask a Question

731 491 924 answers to any question