Maybe I should insert the contents of table2 into an array. Then in my while() I echo 
$participant[$mydata1->district] and $biography[$mydata1->district]
If this is the best solution, how do I code it?

John Taylor-Johnston wrote:

> I want to open table 2 inside table1. See $sql2 below. I know this is illegal.
> How can I work around this? Or can I? Lost cause?
> John
>
> $myconnection = mysql_connect($server,$user,$pass);
> #mysql_select_db($db,$myconnection); #not necessary
> $sql1 = 'select * from '.$db.'.'.$table.' order by district,number asc';
> $myconnection2 = mysql_connect($server,$user,$pass);
> #mysql_select_db($db2,$myconnection2); #not necessary
>
> $news = mysql_query($sql1); //desc => z-a
> while ($mydata1 = mysql_fetch_object($news))
> {
> echo "$mydata1->district<br />$mydata1->meeting<br />$mydata1->time<br />\n";
>
> $sql2 = 'select participant,biography,district from '.$db.'.'.$table2.' where 
> district=$mydata1->district';
> $news2 = mysql_query($sql2); //desc => z-a
>       while ($mydata2 = mysql_fetch_object($news2))
>       {
>        echo "<li>$mydata2->participant</li>\n";
>        echo "<li>$mydata2->biography</li>\n";
>       }
>
>   }
> mysql_close($myconnection);
> mysql_close($myconnection2);

--
John Taylor-Johnston
-----------------------------------------------------------------------------
"If it's not open-source, it's Murphy's Law."

 ' ' '    Collège de Sherbrooke:
 ô¿ô   http://www.collegesherbrooke.qc.ca/languesmodernes/
   -     819-569-2064

  °v°   Bibliography of Comparative Studies in Canadian, Québec and Foreign Literatures
 /(_)\  Université de Sherbrooke
  ^ ^   http://compcanlit.ca/ T: 819.569.2064

Reply via email to