I'm trying to create an imaginary ATM for a schoolproject but I'm stuck on something.
Everything works fine but I can take more money from my account than I have.
For example:
I have 1300 euro's in the database and I input 1400 euro's my system happily updates my balance from 1300 to -100.
And that's exactly what I don't want to happen. My code right no looks like this:
if (( /* i have no clue what comes here */ -$bedrag)>0) // This should become something like: IF "value from database" > "amount" (bedrag=amount btw)
{
echo "Het pinnen is gelukt!";
$pinnen= "UPDATE rekeningen SET Saldo= Saldo - '$bedrag' WHERE Rekeningnr ='$nummer'";
mysql_query($pinnen);
}