1. Проверить, когда начислялся бонус последний раз
2. Если больше дня назад, то начислить бонус и обновить дату получения
$input = SmartInput::parsePost([
'id' => SmartInput::INPUT_INT,
'sex' => ['type' => SmartInput::INPUT_ENUM, 'enum' => ['male', 'female', 'none'], 'default' => 'none'],
'birthday' => SmartInput::INPUT_DATE_OPTIONAL,
'phone' => ['type' => SmartInput::TYPE_PHONE, 'multiple' => true]
]);
$col_article = intval( $col_article );
$col_name = intval( $col_name );
if($col_article == 0) {
$col_article = "";
}
if($col_name == 0) {
$col_name = "";
}
foreach(['col_article', 'col_name'] as $field) {
$$field = (int) $$field;
if($$field === 0) $$field = '';
}
$sql = "SELECT searchArticle and brand from `dk_prices` where searchArticle = ?s and brand = ?s";
$result = $db->query($sql, $articleSearch, $brand);
if(mysqli_num_rows($result) > 0) {
$sql = "UPDATE `dk_prices` SET ?u WHERE searchArticle = ?s and brand = ?s";
INSERT INTO dk_prices SET ?u ON DUPLICATE KEY UPDATE ...