Re: Help: do ... while, reverse data query

From: Date: Wed, 05 Nov 2003 18:13:25 +0000
Subject: Re: Help: do ... while, reverse data query
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-31442@lists.php.net to get a copy of this message
From: "Douglas Freake" <dfreake@zurplus.com> > I need to do a loop where the mysql query starts > at the bottom and goes up, as if the data was in > reverse order. This is for building a category/ > sub_category menu. > > Data structure: (cat_id, cat_sub, cat_name) > > sample routine: > > do { > $sql = "SELECT * FROM categories WHERE cat_id = '$cat'"; > $go = mysql_num_rows($sql_result); > $cat = $row["cat_sub"]; > $cat_id = $row["cat_id"]; > } while ( $go == 1); > > Any ideas how to to start a the end of the database? Yes, it's called an ORDER BY clause. SELECT * FROM categories WHERE cat_id = '$cat' ORDER BY cat_id DESC ---John Holmes...

« previous php.db (#31442) next »