Thread: mysql update
View Single Post
Old 12-04-2009, 07:17 AM   #2 (permalink)
maeltar
The Acquainted
 
Join Date: Nov 2009
Location: nr Stratford-Upon-Avon
Posts: 137
Thanks: 3
maeltar is on a distinguished road
Default

Ok, been a while since you posted but will give you some pointers...

Break the problem down into manageable pieces, work out the logic first..

We will take it as read that the data is already in the DB..

So logic would be something like...

Get current "money" from DB

Decrease current "money" by "cost of item"

Update new balance in DB

Update/create entry for "item purchased"


Now I would point out at this stage that now it's written out a possible issue can be seen...

You have no way of tracking purchases..

So to that end, you would need another table which you would write the purchases (spelling) into, giving you the ability to track customer purchases.

So, you would have 2 tables....

1/ money, with a unique ID for each customer.

2/ purchases, with a fields holding the customer ID, Item Purchased, Cost, date/time

Anyway thats some thoughts for you if you decide to come back and have a look....
__________________
Thanks... Simon

Sex, Drugs & Linux Rules
Send a message via MSN to maeltar
maeltar is offline  
Reply With Quote