Re: Add and Subtract

From: Date: Sat, 02 Mar 2002 00:16:29 +0000
Subject: Re: Add and Subtract
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-17406@lists.php.net to get a copy of this message
my guess is you've got a double-quote problem like that other guy... <? $query="SELECT bank_points FROM wt_users WHERE uid={$session["uid"]}"; ends after the [ because of the double quote Jennifer Downey wrote: > Hi All, > > Would someone please help me with the following code? > > I am trying to make this work like if I have 15 gold pieces and I deposit 5 > it will subtract 5 from the gold pieces I have and deposit the 5 into my > account > showing that I now have 10 gold pieces I can deposit and 5 in the bank. > > I would really appreciate any help. > Thanks in advance. > > Jen Downey > > <BR><BR><BR> > > <FORM ACTION="bank.php" METHOD="POST" TITLE="bank"> > <TABLE BORDER="0" WIDTH="25%" CELLPADDING="0" > CELLSPACING="0"> > <TR> > <TD><font size="2">Deposit</font></TD> > <TD> <INPUT TYPE="text" VALUE="" > NAME="user_deposit"></TD> > </TR> > <TR> > <TD></TD> > <TD><INPUT TYPE="submit" VALUE="Make My Deposit" > NAME="deposit"></TD> > </TR> > </TABLE> > <BR><BR><BR><BR><BR><BR> > <? $query="SELECT bank_points FROM wt_users WHERE > uid={$session["uid"]}"; > > $ret = mysql_query($query); > while(list($points)= > mysql_fetch_row($ret)) > > print("<BR><BR><BR>You have $points Gold Pieces you may > withdraw!"); ?> > <BR><BR><BR> > <TABLE BORDER="0" WIDTH="25%" CELLPADDING="0" > CELLSPACING="0"> > <TR> > <TD><font size="2">Withdraw</font></TD> > <TD> <INPUT TYPE="text" VALUE="" > NAME="user_withdraw"></TD> > </TR> > <TR> > <TD></TD> > <TD><INPUT TYPE="submit" VALUE="Make My Withdraw" > NAME="withdraw"></TD> > </TR> > </TABLE> > </FORM> > <? > $db["bank_points"]=("UPDATE wt_users set bank_points = bank_points + > $user_deposit"); > $result=mysql_query($db["bank_points"]); > > $db["bank_points"]=("UPDATE wt_users set bank_points = bank_points - > $user_withdraw"); > $result=mysql_query($db["bank_points"]);

« previous php.db (#17406) next »