I can order search results by fields (numerically or what have you), but is it possible to get a random return each time? I think I would just do ORDER BY field DESC, put them in arrays, and spit them out randomly. But is it possible to order the results randomly each time? So if I ran the exact same query twice I would get a different order?
Thanks,
Mike
If you're using mysql, just use
order by rand()
That's what I'm doing with the colums list in the left-hand side of the page.
Tim,
When I use the order by rand() I get zero rows returned. Do I need to include anything else. My code is:
Select job_id from job where title like '$keyw' order by rand()
Paud
Should be order by <fieldname> rand(), I think.
Hmm, I'm getting an error when I do order by rand() or order by <field> rand()...
ERROR 1064: You have an error in your SQL syntax near 'rand()' at line 1
Ideas?
Mike,
I found the following works fine:
Select field_you_want, any_numeric_field*0+RAND() AS randcol from table_name ORDER BY randcol;
This gives a different selection with each refresh.