Current location: Hot Scripts Forums » Programming Languages » PHP » Need another advice (php-mysql)


Need another advice (php-mysql)

Reply
  #1 (permalink)  
Old 09-19-09, 11:46 AM
zippoxer zippoxer is offline
Newbie Coder
 
Join Date: Dec 2008
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Need another advice (php-mysql)

Hello, I just need an advice about saving a special kind of data in mysql with php :]

I have a table called hunting_areas, it has a field called looted_items.
In looted_items, there should be some items ids and their chance (chance for the user to get them in the specific hunting area). here's an example row (there should be many like this):
Code:
3-80;1-34;5-69;9-13
So in that example row, the user can get item id 3 with a chance of 80%, item id 1 with a chance of 34%, item id 5 with a chance of 69% and item id 9 with a chance of 13%.

There are a lot of other ways to do the above mission for example:
removing the looted_items field and placing: looted_items_ids and looted_items_chances.
an example row (first code is looted_items_ids and second looted_items_chances):
Code:
3;1;5;9
Code:
80;34;69;13
For those who understood, any better ways you know to store this kind of data? In case you didn't understood reply here I'll explain this otherwise.
Reply With Quote
  #2 (permalink)  
Old 09-19-09, 03:27 PM
wirehopper's Avatar
wirehopper wirehopper is offline
-
 
Join Date: Feb 2006
Posts: 2,515
Thanks: 20
Thanked 109 Times in 106 Posts
You could use an array or database table, with the ids serving as the indexes and the chances as the values.

Array:

$aLooted[$id]=$chance;

Database:

Table of looted items would have ids, names, and chances.
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
RESELLER WEB HOSTING - $9.99/MONTH For 4GB HD & 30GB BW! CPanel, PHP, MySQL & MORE! IncognitoNet General Advertisements 0 10-13-05 10:08 AM
RESELLER WEB HOSTING - $9.99/MONTH For 4GB HD & 30GB BW! CPanel, PHP, MySQL & MORE! IncognitoNet General Advertisements 0 07-14-05 10:56 AM
Complex mysql sorting pb (Get cat_list from cids &pcids with 1 query, willing to pay) aqw PHP 1 06-23-05 07:02 PM
RESELLER WEB HOSTING - $9.99/MONTH For 4GB HD & 30GB BW! CPanel, PHP, MySQL & MORE! IncognitoNet General Advertisements 0 10-30-04 01:19 PM
PHP, MySQL, WML superman PHP 0 03-04-04 10:46 AM


All times are GMT -5. The time now is 07:59 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.