Selecting a range of rows and then selecting one at random
Posted: Tue Mar 07, 2006 11:40 pm
Currently, I use this code:
I select a random row from the entire list.
What I want to do is select a random row from ONLY the rows with a points variable > 1.
Code: Select all
$sql="SELECT * FROM `accounts`";
$result=mysql_query($sql);
$mnumber = mysql_num_rows($result);
$rnumber = rand(1, $mnumber);
$sql="SELECT * FROM `accounts` WHERE account_id = $rnumber";What I want to do is select a random row from ONLY the rows with a points variable > 1.