Hi everyone,
I have been ripping my hair out for the past 6 hours with this and figured it was time to break down and ask for help.
I am making a query to grab a random list of people from a database. I want to take those random results and resort them to put in order of last name, before displaying them in the page.
I have tried several things and nothing seems to work correctly. Here is what I have so far....
$query = "SELECT * FROM myTable order by rand() limit 100";
$result = mysql_query($query);
while ($r = mysql_fetch_array($result)) {
$id = $r["id"];
$lname = $r["lname"];
$fname = $r['fname'];
echo "$lname, $fname <br>";
}
This of course dumps it out in the random order it pulled it. I have tried -- order by rand(), lname desc -- but that doesnt work.
Any suggestions as to what I am overlooking?
Thank you in advance.
Nibbi :-)