Jump to content

php/mysql game help


Rifts

Recommended Posts

hey everyone

to keep it simple, im trying to make a game and can not figure out how to set up the database for the items

say there are 10 items to keep it simple

 

here is what i came up with but what do i do to track if a player has more than one of the same item so if someone has 3x soild gold bars?

 

thanks for the help

 

 

Item Name         Price   Array Name Image Name      

 

Copper lock pick   10   copperpick      copperpick.jpg

Solid gold bar           20   solidgold   solidgold.jpg

iron lock pick           20   ironpick   ironpick.jpg

Fine mythral pick   30      mythralpick      mythralpick.jpg

Rare magic lock pick  4000  nullmagicpick  nullmagicpick.jpg

Shopowner’s deed   400    shopdeed   shopdeed.jpg

 

Link to comment
https://forums.phpfreaks.com/topic/195342-phpmysql-game-help/
Share on other sites

Items table:

Id | Item | Price | Img

 

Useritems

Id | Item_id | User_id | Qty

 

So you have the items in one table and then when the user buys an item its added to the useritems table so if user brough 5x solidy gold bar in user items it would be inserted in user items as

 

id: normally as a key auto increm

item id: 2

user id: whatever there user id is (i use there id number)

qty: 5

 

You then link it to the purchase screen. Hope that makes sense

Link to comment
https://forums.phpfreaks.com/topic/195342-phpmysql-game-help/#findComment-1026531
Share on other sites

i just got done creating a database which follows what you said but i got to thinking about i dont understand how this will work when more than one person gets the item

 

will the database just be full of stuff like this

 

Id | Item_id | User_id | Qty

 

1  1    1245324    3

2  2    1245324    4

 

and then if someone else has the same item there will be another entry for that user too right

 

is it possible to have to much in a database? or is it ok for example lets pretend i get 1000 users and they each have 5 items

that will be 5000 different entries into this database is that ok?

Link to comment
https://forums.phpfreaks.com/topic/195342-phpmysql-game-help/#findComment-1026554
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.