might i ask anyone how would i be able to do a random query?
I have a table full of profiles and everytime the page loads it loads a new profile from the DB.
how would i go about doing this?
any help would be greatly appreciated.
thanks!
Something like this will work:
... $startNum = 0; $endNum = ?; // ? is an integer srand(time()); $number = rand($startNum, $endNum); $sql_statement = "select * from table limit $number,1"; ...
there's even an easier way:
$sql_statement = "select * from table ORDER BY rand() LIMIT 0,1";
This will order the results by random and return just one row!