View Single Post
Old 06-10-2003, 03:44 PM   #4 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,505
sde is on a distinguished road
ahh .. you have multiple topics per issue? i think i understand now. here's a quick snippet that nests a loop inside another loop.
PHP Code:
<?
// query "a"
$resulta mysql_query("select * from  topics, horizons");

// row count "a"
$num_resultsa mysql_num_rows($resulta);

// loop "a"
for($a=0;$i<$num_resultsa;$a++)
{
  
$issue_id=mysql_result($resulta,$a,"issue_id");

  echo 
"this is issue_id:" $issue_id "<br>\n";

  
// query "b"
  
$resultb=mysql_query("select * from topics where issue_id='$issue_id'");

  
// row count "b"
  
$num_resultsb=mysql_results($resultb);

  
// loop "b"
  
for($b=0;$b<$num_resultsb;$b++)
  {
    
$topic_id=mysql_result($resultb,$b,"topic_id");

    echo 
"this is topic id: " $topic_id "<br>\n";
  }
}
?>
good luck!
__________________
Mike
sde is offline   Reply With Quote