Jump to content

[SOLVED] Randomly Select a Row


codexx

Recommended Posts

Hey Everyone,

 

I have to do a script where a user fights an enemy. There are many to choose from all for differn't levels in which the user is at.

 

I need to first (SELECT * FROM creep_data WHERE minlvl < '".$user[lvl]."' AND maxlvl > '".$user['lvl']."'")

 

After I have all of the possible monsters I need to randomly select one of these and retrieve all of the data about it.

 

How could I go about doing this :)?

 

Thanks in advance,

Sean

Link to comment
https://forums.phpfreaks.com/topic/56816-solved-randomly-select-a-row/
Share on other sites

Primary key is ID.

 

When I try $creepinfo = mysql_query ("SELECT * FROM creep_data WHERE minuserlvl < '".$user[lvl]."' AND maxuserlvl > '".$user['lvl']."' ORDER BY id rand()");

 

it gives me an error. Is there anyway I could get all off the possible creeps then randomly select on in an array?

  • 3 weeks later...

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.