I am looking for a nice way to do the following , in PHP / mySQL
Select a random row from a database , with a certain dateType
Assign the values read out to variables
Database has columns,
dateType, date1 , date2, date3
PHP Code:
= "SELECT * FROM reserved dates WHERE dateType='2'
ORDER BY RAND()
LIMIT 1";
= mysql_query();
while( = mysql_fetch_array(, MYSQL_ASSOC))
{
echo "Date1: <br>" .
"Date2: <br>" .
"Date3: <br><br>";
}
I was just wondering if there is a more graceful way of doing i, rather than doing a while loop there ? Plus the query is probably very slow they way I have it. Maybe I will just use this :
http://www.greggdev.com/web/articles.php?id=6