i need some help with extracting data from mysql desperately!!

From: Date: Thu, 10 May 2001 15:49:29 +0000
Subject: i need some help with extracting data from mysql desperately!!
Groups: php.general 
Request: Send a blank email to php-general+get-52308@lists.php.net to get a copy of this message
unfortunately, that doesn't seem to work either. it basically only gives me on name per group. here's my php: $query = "SELECT * FROM $tablename WHERE approved='yes' GROUP BY group ORDER BY group, name"; $result2 = mysql_query($query2); if ($result2) { while ($r2 = mysql_fetch_array($result2)) { extract($r2); echo " <strong>$folder</strong><br> &nbsp;&nbsp;$name <br>"; } } all it does is print out one name per group, and if there is more than one name in a group, it comes up sperately (but the group name goes missing). basically i need this: > group1 >name1 >name2 >name3 >group2 >name4 >name5 thanks for any help, i'm sure this is something really straightforward, but i can't put my finger to it.... tia! /sunny -----Original Message----- From: bill [mailto:bill@billtron.com] Sent: 10 May 2001 14:58 To: php-general@lists.php.net Subject: Re: [PHP] i need some help with extracting data from mysql Sandeep, Try: $sql="SELECT group, name FROM $tablename WHERE approved='yes' ORDER BY group, name"; Don't know what fieldname "folder" is in your original SQL. You said that the table had only id, group, & name. But I note that you must also have a fieldname called "approved". In any case, assuming the fieldnames are correct, the above should work. kind regards, bill hollett

« previous php.general (#52308) next »