grouping by category

From: Date: Thu, 04 Apr 2002 02:15:59 +0000
Subject: grouping by category
Groups: php.db 
Request: Send a blank email to php-db+get-18181@lists.php.net to get a copy of this message
Hey Guys, I'm trying to get my script to group all my reviews by category now but now it just displays them all in a row a bunch of times and doesn't group them how I want it to group them. I want it too look like this: Processor Reviews - Review - Review Motherboard Reviews - Review -Review Heres my syntax, and the page is online here (http://www.hardware-unlimited.com/hardware2.php) so you can see how it is executed now: <?php $db = mysql_connect( "db32.pair.com", "net3dual_2", "*******"); mysql_select_db( "net3dual_reviews",$db); file://select cateogries $r = mysql_query("SELECT category FROM hwureviews ORDER BY num DESC"); while($a=mysql_fetch_array($r)) { $category = $a["category"]; file://select reviews for the current category $select_reviews = "select url, author, name from hwureviews where category='".$a["category"]."'"; $reviews = mysql_query($select_reviews); while($rev=mysql_fetch_array($reviews)) { $name = $rev["name"]; $author = $rev["author"]; $url = $rev["url"]; $email = $rev["email"]; file://print out review info echo "$category Reviews:<br>"; echo "- <a href=\"$url\">$name</a> (Written by: <a href=\"mailto:$email\">$author</a>) - [<a href='$url' onMouseOver='if (window.event || document.layers) show(\"$name\",event)' onMouseOut='hide(\"$name\")'>Description</a>]<br><br>"; } // end review while } // end category while ?> What do I need to do? Thanks! -------------------------------------------- -Alex "Big Al" Behrens E-mail: bigal@3d-unlimited.com Urgent E-mail: bigal-cell@3d-unlimited.com (Please be brief!) Phone: 651-482-8779 Cell: 651-329-4187 Fax: 651-482-1391 ICQ: 3969599 Owner of the 3D-Unlimited Network: http://www.3d-unlimited.com Send News: news@3d-unlimited.com

« previous php.db (#18181) next »