Hi all,

I'm still banging my head on this.

Let's say I have $1000 to withdraw from my account. I withdraw that $1000
which leaves me $0 dollars in the account.
With the code below if I enter another $1000 dollars in the form and hit
enter it loans me the thousand and puts my account at -$1000 dollars.
What do I need to do to stop it from loaning me the thousand and keep me
from having a negative balance?

 <TD><font size="2">Withdraw</font></TD>
 <TD> <INPUT TYPE="text" VALUE="" NAME="user_withdraw"></TD>
 <TD><INPUT TYPE="submit" VALUE="Make My Withdrawal" NAME="withdraw"></TD>

// used to update if a user makes a withdrawal
$query = ("UPDATE wt_users set bank_points = bank_points - $user_withdraw,
points = points + $user_withdraw WHERE uid={$session["uid"]}");

// select bank points for the user.
$sql_result = mysql_query("SELECT bank_points FROM wt_users WHERE
$row = mysql_fetch_array($sql_result);
// if bank points are at 0 then print no points and quit.
if ($sql_result <= "0") {
         echo "you don't have that many points";
} else {
   echo "Your withdraw has been made!";

Thanks again in advance

Jennifer Downey

PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to