Jump to content

Randomising a database item? HELP PLEASE


widget

Recommended Posts

I have a database table called items containing id, item_name, item_id, rarity etc etc.

 

I would like to be able to extract items from my table based on their rarity and then randomly choose one of these items.

 

something along the lines of

 

$prize = fetch("SELECT item_id FROM items WHERE rarity = '7'">
then some code that grabs just one random item_id

 

Any help would be much appreciated.

 

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/81915-randomising-a-database-item-help-please/
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.