str3tch4eva Posted May 19, 2011 Share Posted May 19, 2011 Hi friends, I am creating a site where users can add credit to their account via Liberty Reserve, and after that their account will automatically be updated with the amount they added so that they can use it to purchase products.. And after any purchase, the amount will be subtracted from their account.. I cant really find a php code to do that... i have done a search on here but still cant find anything close to it.. Can someone kindly help? Thank you Quote Link to comment https://forums.phpfreaks.com/topic/236896-updating-account-balance/ Share on other sites More sharing options...
fugix Posted May 19, 2011 Share Posted May 19, 2011 are you storing account information in a database? Quote Link to comment https://forums.phpfreaks.com/topic/236896-updating-account-balance/#findComment-1217737 Share on other sites More sharing options...
str3tch4eva Posted May 19, 2011 Author Share Posted May 19, 2011 Yes.. every user has a user name so when you buy credits, its suppose to reflect in your account.. Quote Link to comment https://forums.phpfreaks.com/topic/236896-updating-account-balance/#findComment-1217739 Share on other sites More sharing options...
jakebur01 Posted May 19, 2011 Share Posted May 19, 2011 Find a shopping cart tutorial. Build a basic cart that works off a MySQL table then add this other stuff in later. It would be that hard to do what your wanting to do, but you should build your foundation first. Quote Link to comment https://forums.phpfreaks.com/topic/236896-updating-account-balance/#findComment-1217744 Share on other sites More sharing options...
ignace Posted May 19, 2011 Share Posted May 19, 2011 Liberty Reserve provides ready made scripts for you to test/run at https://www.libertyreserve.com/en/home/downloads Quote Link to comment https://forums.phpfreaks.com/topic/236896-updating-account-balance/#findComment-1217745 Share on other sites More sharing options...
fugix Posted May 19, 2011 Share Posted May 19, 2011 do you want to create this yourself or use someone elses script? Quote Link to comment https://forums.phpfreaks.com/topic/236896-updating-account-balance/#findComment-1217746 Share on other sites More sharing options...
str3tch4eva Posted May 19, 2011 Author Share Posted May 19, 2011 a friend gave me a script to use but that part isnt there and i am finding it difficult to figure it out.. Quote Link to comment https://forums.phpfreaks.com/topic/236896-updating-account-balance/#findComment-1217752 Share on other sites More sharing options...
str3tch4eva Posted May 19, 2011 Author Share Posted May 19, 2011 do you want to create this yourself or use someone elses script? I know about that but it doesnt update the account of the user that makes the payment.. Thank you anyway Quote Link to comment https://forums.phpfreaks.com/topic/236896-updating-account-balance/#findComment-1217754 Share on other sites More sharing options...
jakebur01 Posted May 19, 2011 Share Posted May 19, 2011 That's the way PHP was for me when I first starting dealing with it. I finally went and bought a good book on it and started from the beginning and gradually worked my way through it. It actually had a shopping cart in the back of it. By the time I got to the shopping cart, I knew my way around in the code. Quote Link to comment https://forums.phpfreaks.com/topic/236896-updating-account-balance/#findComment-1217755 Share on other sites More sharing options...
fugix Posted May 19, 2011 Share Posted May 19, 2011 do you want to create this yourself or use someone elses script? I know about that but it doesnt update the account of the user that makes the payment.. Thank you anyway you could script it to do so Quote Link to comment https://forums.phpfreaks.com/topic/236896-updating-account-balance/#findComment-1217756 Share on other sites More sharing options...
str3tch4eva Posted May 19, 2011 Author Share Posted May 19, 2011 @ Fugix, That is why i am asking for help on here.. Quote Link to comment https://forums.phpfreaks.com/topic/236896-updating-account-balance/#findComment-1217766 Share on other sites More sharing options...
ignace Posted May 20, 2011 Share Posted May 20, 2011 do you want to create this yourself or use someone elses script? I know about that but it doesnt update the account of the user that makes the payment.. Thank you anyway The hard part is actually making the payments updating the account's balance should be easy. Something along the lines of: $sql = "UPDATE account SET balance += $points WHERE account_id = $account_id"; if (mysql_query($sql)) { // succeeded } Quote Link to comment https://forums.phpfreaks.com/topic/236896-updating-account-balance/#findComment-1217902 Share on other sites More sharing options...
str3tch4eva Posted May 22, 2011 Author Share Posted May 22, 2011 do you want to create this yourself or use someone elses script? I know about that but it doesnt update the account of the user that makes the payment.. Thank you anyway The hard part is actually making the payments updating the account's balance should be easy. Something along the lines of: $sql = "UPDATE account SET balance += $points WHERE account_id = $account_id"; if (mysql_query($sql)) { // succeeded } Thank you Ignace.. I think this should work then, because the payment is via LR and that is easy.. so i will try and let you know.. thanks again. Quote Link to comment https://forums.phpfreaks.com/topic/236896-updating-account-balance/#findComment-1218625 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.