I have two tables in a mysql databse 'topics' and 'horizons' for a newsletter . Topics contains 'issue' 'list' 'topic' 'link' and 'category' columns. Horizons has 'issue' 'month' 'pdf_name' 'file_size' and 'year' columns. What I'm trying to do is to have the Issue number and date with a link to both html and pdf versions, but also have the topics from each newsletter alongside. At the moment I have everything working can't find a way of looping through the topics and placing them alongside the associated issue without looping multiple versions of the issue, or just repeating the same topic. Do I need to use another nested array for the topic, or create another mysql query, or can I use something like while(), foreach() or for() to do this with the query I have?
PHP Code:
  if (!
"Error: Could not connect to database.  Please try again later.";

// get results from horizon and topic tables 

$query "select * from  topics, horizons where topics.issue = horizons.issue order by topics.issue desc";
$result mysql_query($query) or die(mysql_error());
$num_results mysql_num_rows($result);
$row mysql_fetch_array($result);

// add topics and links etc

echo "
            <tr align='left' valign='left' > 
            <td height='26' colspan='5' >&nbsp;</td>
            <tr align='left' valign='left' >
            <td width='200'align='left' ><font face='arial' size='2' color='#000099'>
             Issue "
.$issue."&nbsp;&nbsp;&nbsp;$month&nbsp;$filesize</font><p><a href='issue".$issue."/index.html'><font face='arial' size='1' color='#660000'>View <b>
             HTML </b></font></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;             </p>
               <p><a href='issue"
.$issue."/".$link."'><font face='arial' size='1' color='#660000'>View <b> PDF ".$filesize."k </b></font></a> &nbsp;&nbsp;</p>
             <td colspan='2' valign='top'> <div align='middle'><a href='"
.$link."'><font face='arial' size='2' color='#660000'><b>
.$topic." </b></font></a></div></td>
             <td >&nbsp;</td>
          <td height='22'>&nbsp;</td>
          <td >&nbsp;</td>
          <td >&nbsp;</td>
          <td >&nbsp;</td>
// build headings and tables    
echo"     <tr>
                       <td colspan='5'><div align='right'>
                          <a href='#top'><img src='images/totop.gif' width='100' height='23' border='0' class='totop'></a></div></td>
                    <tr  bgcolor='#aea981'>
                      <td colspan='5'><div align='left' >
                        <a href='horizonstopic.htm'><font face='arial' size='2' color='#000099'>View by Topic</font></a></div></td>