Forum Moderators: coopster
$result = mysql_query( "SELECT g.*, c.* FROM groups as g JOIN categories as c where g.group_id = c.group_id" )
or die("SELECT Error: ".mysql_error());
$entry_lines="";
while ($query_data = mysql_fetch_array($result)) {
$entry_lines .= "..¦ ".$query_data['group_name']. "¦¦¦¦¦1\n";
$entry_lines .= "...¦".$query_data['category_name']." ¦";
$entry_lines .= "display3.php?searchitem=product_name&id=".$query_data['category_id']."¦\n";
$fp = fopen("layersmenu-vertical-1.txt", "w");
fputs($fp, $entry_lines); // fwrite() alias
fclose($fp);
}
?>
I need a loop to go through the table and identify all the category names that are in a particular group name (tables are linked by group_id).
So in the end it will print out
Group Name 1
Category Name in group name 1
Another Category Name in group name 1
Another Category Name in group name 1
Group Name 2
Category Name in group name 2
Another Category Name in group name 2
Another Category Name in group name 2
etc...
At the moment I get
Group Name 1
Category Name in group name 1
Group Name 2
Category Name in group name 2
etc...
Any Help would be greatly appreciated
Thanks in advance
You started out this thread by saying, "I have a simple script...," but, really, how simple did even that seem before I wrote it for you?