S
S
Slanty2019-07-23 14:08:10
Python
Slanty, 2019-07-23 14:08:10

How to validate a value from a database?

There is a database on sqlite
It stores the following data: id, money
I want to make a 'Guess the number' game, almost everything is ready, what remains is to make a money check so that the user cannot enter a bet more than his balance in the database
I can't figure out how do this check

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
alternativshik, 2019-07-23
@alternativshik

if bid > money:
return "error"

K
Konstantin Tsvetkov, 2019-07-23
@tsklab

It stores the following data: id, money
If this is "balance", then compare with it. But if the user has several such records, then you need to add his code to this table and compare with the sum of all these records.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question