I make the user's balance in PHP (the balance can not be less than zero).
Suppose I replenish the balance by 10 rubles and buy goods for 10 rubles. Payment passes, and the balance becomes 0. But when I replenish the balance by 8 rubles and buy goods for 8 rubles (the price of goods is stored in the database), then payment does not occur, there is no error in the PHP log. What could be the problem?
Just in case the balance code:

 if ($id && $job_user) { $job->balance = $job_user->balance - abs($this->GetWeight($packing[$id_product])) * $num_packing[$id_product]; $this->users->update_job($id_user, $id_product, $job); 

Just want to note that there is a payment of any amount, except the number 8.

Closed due to the fact that it is off topic by participants aleksandr barakin , user207618, pavel , Streletz , user194374 Aug 21 '16 at 6:05 .

It seems that this question does not correspond to the subject of the site. Those who voted to close it indicated the following reasons:

  • “Questions asking for help with debugging (“ why does this code not work? ”) Should include the desired behavior, a specific problem or error, and a minimum code for playing it right in the question . Questions without an explicit description of the problem are useless for other visitors. See How to create minimal, self-sufficient and reproducible example . " - pavel, Streletz, Community Spirit
  • "The question is caused by a problem that is no longer reproduced or typed . Although similar questions may be relevant on this site, solving this question is unlikely to help future visitors. You can usually avoid similar questions by writing and researching a minimum program to reproduce the problem before publishing the question. " - aleksandr barakin, community spirit
If the question can be reformulated according to the rules set out in the certificate , edit it .

  • one
    How to test the hypothesis about 8? All other parameters are kept the same? In any case, without the code of the update_job, GetWeight, balance methods, it is impossible to say anything definite - rjhdby
  • I have a drop-down list with amounts from 1 to 10, and so with all the payment goes, but with eight is not. I think if there was a mistake in the code, then others would not be considered. - user197085
  • one
    Well, do not you think that you have found the fundamental problem of the universe, concluded in figure 8? Of course in the code, what else. - rjhdby
  • one
    @JohnDoe, is everything ok with the list? - DanielOlivo
  • @JohnDoe Well, the code for the list would be to check - rjhdby

1 answer 1

The problem was in the data type in the database. The data were in the type of float (5,2), they simply did not fit in the calculations.