[Tutor] Some help Please

JOSEPH MARTIN MPALAKA josempalaka at gmail.com
Wed Feb 15 15:17:36 CET 2012


take an example of updating Bank Accounts,
gaving the following table:

acc_id		acc_name	    standing_Balance
mn0001		computer	     20000

my problem is how can i credit the standing balance from user data,as
in making a deposit onto the computer account, using the code below:-



import MySQLdb as mdb
import sys

con = mdb.connect('localhost', 'joseph', 'jmm20600', 'savings');

dep = input('Enter Amount: ')

            cur.execute("UPDATE accounts SET Standing_Amount =
(Standing_Amount + dep) WHERE Acc_ID = 'MN0001'")

	    conn.commit()

HOw do i format "dep" in order to be added onto the standing_Amount,to
make an increment?

Please, is it the same thing with the withdrawing format, in case i
want to decrement the account as in withdrawing??


joseph









-- 
MY BEING was HIS BEING.  Of what is magnificent and liked of me, this
was him too. In VAIN, I will always miss u,thou i live with YOU in
vain.
                   Lt.Col.Sam .E. Lukakamwa  (DADDY)



-- 
MY BEING was HIS BEING.  Of what is magnificent and liked of me, this
was him too. In VAIN, I will always miss u,thou i live with YOU in
vain.
                   Lt.Col.Sam .E. Lukakamwa  (DADDY)



-- 
MY BEING was HIS BEING.  Of what is magnificent and liked of me, this
was him too. In VAIN, I will always miss u,thou i live with YOU in
vain.
                   Lt.Col.Sam .E. Lukakamwa  (DADDY)


More information about the Tutor mailing list