Catagory list

From: Date: Fri, 30 Mar 2001 12:33:11 +0000
Subject: Catagory list
Groups: php.general 
Request: Send a blank email to php-general+get-46304@lists.php.net to get a copy of this message
I am trying to make a catagory list that displays a distinct catagory, and then listing titles under that catagory. Unfortunatly all the data is in one table, and the catagory field is not set catagories, so there is duplicates in that field. The code so far is (but I am probably going about it the wrong way, if you can see whats wrong with my code plase help, or point me in some direction), $query = mysql_query("SELECT DISTINCT catagory from article order by catagory"); $query2 = mysql_query ("SELECT * from article ORDER BY catagory"); for ($index = 0; $index < mysql_num_rows($query); $index++) { $Catagory = mysql_fetch_row ($query) or die (mysql_error()); $name1 = mysql_fetch_row ($query2) or die (mysql_error()); $x = $name1; $result1 = array_unique($Catagory); $result = array_merge($Catagory, $name1); print ("$result1[0]<BR>"); for ($x=0; $x == $result1[0]; $x++) { print ("&nbsp;&nbsp;&nbsp;&nbsp;<a href='update.php?passed=$name1[0]'>$name1[2]</a><br>\n"); } } I am trying everything to get it do just print the following: Catagory title1 title2 Catagory1 title3 title4 Please help me out.... thanks

« previous php.general (#46304) next »