Heres the actual code:
<?php
page_open(array("sess" => "example_Session",
"auth" => "example_Auth",
"perm" => "example_Perm"));
$uid=$auth->auth[uname];
$s=new Template("templates");
$query="select user
from possibles
where user_id='$uid'
and view='y'
order by date desc";
$result=mysql($DB,$query)
or die("Could not retrieve data from the database " . mysql_error() . "query=$query<br>");
while($ra=mysql_fetch_array($result)){
$users[]=$ra['user'];
}
if(count($potentials)>0){
$s->set_file(array("con"=>"list.tpl"));
$s->set_block("con","USER","USERS");
foreach($user as $users){
//echo "<br>match = $match<br>sub_array = ";
$sub_query="select name, interest
from details
where user_id='$user'";
$sub_result=mysql($DB,$sub_query)
or die("Could not retrieve data from the database " . mysql_error() . "query=$sub_query<br>");
$sub_array=mysql_fetch_array($sub_result);
//print_r($sub_array);
$s->set_var(array("UNAME"=>$match,
"NAME"=>$sub_array['name'],
"INTEREST"=>$sub_array['interest']));
$s->parse("USERS","USER",true);
}
} else {
$s->set_file(array("con"=>"nomusers.tpl"));
}
$s->set_var(array("SELF"=>$self));
$CONTENT=$s->parse("OUT","con");
page_close();
?>
The details from the second select are just parsed into a template to generate a list of potntial users and interests...