I believe what I need to use is an array at any rate.
What I'm looking to do is query a table and get a list of all the rows not marked "used" - and then loop through each of those to get a random result of the original query result.
For example, lets say I'm working with this table :
|----------------------|
| ID NAME USED |
|----------------------|
| 1 Alpha 0 |
| 2 Bravo 1 |
| 3 Charlie 0 |
| 4 Delta 1 |
| 5 Echo 1 |
| 6 Foxtrot 0 |
| 7 Golf 0 |
| 8 Hotel 1 |
| 9 India 0 |
| 10 Juliet 1 |
|----------------------|
What I need to do is get all of the "Names" that have a "Used" value of 0 - which in this case would be :
Alpha, Charlie, Foxtrot, Golf, India
That's easy to do by itself :
$sql = "SELECT * FROM table WHERE used != '1'";
$result = @mysql_query($sql, $connect) or die(mysql_error());
But then I need to take that result of Alpha, Charlie, Foxtrot, Golf, India and somehow loop through them to create something similar to a RAND() command so the code selects one of the 5 results at random.
I am still fairly new to arrays - and I don't really even know where to begin with this.
Thanks -