Click to See Complete Forum and Search --> : Shop System in php for a online game


william232
07-18-2006, 04:26 AM
hi there i am wondering to create a shop system where a user can buy items and other things in it and by more than 1 copy of somthing and and if there is a certain amount in stock they cant buy anymore how is this possible using php also having a system for me to add/edit/remove items from the store how can i achieve this?

Sheldon
07-18-2006, 05:08 AM
Well depending on your PHP skill it can be done, If you arnt so hot on PHP then htere are free PHP driven shopping carts all over the net.

william232
07-18-2006, 05:16 AM
my php skills is alrite just isnt that great if you can help me wif showing of th items and oter things can u help me is that possible?

william232
07-18-2006, 09:21 PM
ok i've figured it out but i am trying to create some sort of currency and game money without dealing with real money like paypal how do i go about doing somthing like this?

NogDog
07-18-2006, 09:30 PM
You are definitely going to want to use a database (to track inventories, "money", purchases, etc.). So the first question is: how comfortable and knowledgeable are you about working with a database?

william232
07-18-2006, 10:34 PM
i am fine working with databases wat sort of stuff would i need in the database maybe you can give me a hand to sort out all the purchases

NogDog
07-18-2006, 11:08 PM
At a minimum, I see 3 tables:
user - has columns to define each "buyer", including how much "money" he currently has
item - one row for each thing that can be purchased, including columns for ID, description, cost, number available
user_to_item - one row for each item owned by a user, with columns for user_id, item_id, quantity

william232
07-18-2006, 11:14 PM
on my shop page how will i make it so that the user has enough money to buy or if he has more than enough money just takes away the required amount to buy a certain item?

BestZest
07-19-2006, 11:09 AM
NogDog is being very helpfull, but I think it would be appreciated if you used some fullstops and capital letters.

And I hope you realise what you want to create is going to be at least a moderately complicated system; something that needs to be planned and will use more than just beginner PHP.

As an answer to your previous question, you'll need to use SQL query/ies to get the amount of money a user has, and then compare it with the price of the product.

william232
07-19-2006, 05:17 PM
yes i maybe abit of a beginner when doing this type of php script system before i am alright with php which type of query would i need to get the amount of money and seeing if the user has greater amount higher than what the item is price is.

LiLcRaZyFuZzY
07-19-2006, 05:23 PM
Have a look at these to understand basic MySQL commands:

http://www.php.net/manual/en/function.mysql-connect.php
http://www.php.net/manual/en/function.mysql-query.php
http://www.php.net/manual/en/function.mysql-fetch-array.php

In all cases you'll need SELECT and UPDATE queries