Page 1 of 1

sort

Posted: Tue Mar 09, 2004 11:14 am
by ol4pr0
how do i sort(); this query?

Code: Select all

// this is what i have now 
$result = mysql_query("SELECT pages, name FROM links");
while (list($pages, $name) = mysql_fetch_row($result)) {
    echo " \n" .
          "<a href="$pages?id=$name" target="I1">$name</a><br>\n" .
          "\n";
}

Posted: Tue Mar 09, 2004 11:16 am
by markl999
$result = mysql_query("SELECT pages, name FROM links ORDER BY pages");
or
$result = mysql_query("SELECT pages, name FROM links ORDER BY name");
or
$result = mysql_query("SELECT pages, name FROM links ORDER BY pages DESC");
or
$result = mysql_query("SELECT pages, name FROM links ORDER BY name DESC");

:o

Posted: Tue Mar 09, 2004 11:29 am
by patrikG
You're certainly familiar with order by?

Edit: Gah, that happens when the phone rings. I didn't hit post until 20 minutes later ;)

Posted: Tue Mar 09, 2004 11:34 am
by ol4pr0
dumb dumb dumb ... Of me..

Posted: Tue Mar 09, 2004 11:41 am
by patrikG
No worries. First time I used mysql I started writing a bubble-sort algorithm in PHP, because I didn't know order by existed...;)

Best thing is to go nuts, throw yourself into a wonderfully hot whirlpool, sip a nice cocktail and watch the sunset.

Hell, that's what I want to do now, anyway.

Posted: Tue Mar 09, 2004 12:03 pm
by ol4pr0
Well its 36 C in my country @ the moment.. ( only missing the cocktails @ work ehehehh )