This involves three data tables for a postnuke site. One is called nuke_yp_business, the second is nuke_yp_memberships, the other is nuke_yp_assns.
nuke_yp_bussiness has one relevant (to this discusson) data field: busid
nuke_yp_memberships has 4 relevant fields: busid; assnsid; status; years.
nuke_yp_assns has 2 relevant fields: assnsid; name.
For a business identified by $busid, I want all organizations where m.busid = $busid. I want to print a list in 3 columns where: column 1 is the organizations' name (from nuke_yp_assns); column 2 is status (from nuke_yp_memberships); and column 3 is the years (also from nuke_yp_memberships).
Unfortunately, my best shot (see below) isn't workng.
Can somebody help me please?
<?php
$boxstuff = "";
$sql .= "select a.assnid, a.name, m.*";
$sql .= " from $pntable[yp_assns] a, $pntable[yp_membership] m ";
$sql .= " where m.busid = $busid";
$sql .= " and a.assnid = m.assnid";
$result=mysql_query($sql);
while ($memarray = mysql_fetch_array($result)) {
$boxstuff .= "<tr><td width=\"50%\"><font size=1>".ifconstant($memarray[a.name])."<br></td><td width=\"25%\">".ifconstant($memarray[m.status])."</td><td width=\"25%\">".ifconstant($memarray[m.years])."</td></tr>";
}
$boxstuff .= "";
$row[content] = $boxstuff;
themesidebox($row);
echo "</table><br><hr><br>\n</td></tr>\n";
?>