I want to display the results of my query in 2 columns, alphabetical order top to bottom. First column 1 then column 2.
For example:
Column 1[COLOR=F1F1F1].............[/COLOR] Column 2
A[COLOR=F1F1F1]........................[/COLOR] D
B[COLOR=F1F1F1]........................[/COLOR] E
C[COLOR=F1F1F1]........................[/COLOR] F
I must be a total idiot! I've read several tutorials on this subject, each with a different approach, and I'm totally lost. I know this is a PHP 101 question but I'd be eternally grateful if someone could help me with this code:
<tr align="center" valign="middle">
<td width="50%" height="30"><?php
$sql="select *";
$sql .= " from $pntable[yp_assns] a ";
$sql .= " where (catid = $category AND regionid = $region) OR (catid = -1 AND regionid = -1) OR (catid = -1 AND regionid = $region)";
$sql .= " order by abreviation";
$result = mysql_query($sql);
if (!ypSqlError($sql,$result,mysql_errno(),mysql_error(),"60")) {
$numcat = mysql_numrows($result);
$numbercol = 2 ;
$numrows = floor($numcat / $numbercol);
$numextrarows = $numcat - ($numrows*$numbercol);
$colstogo = $numbercol;
$numrows++;
while($colstogo-- > 0){
$rowstogo = $numrows;
$numextrarows--;
?>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<?php
while($rowstogo-- > 0) {
if ($rowstogo < 1 and $numextrarows < 0) {
} else {
$catarray = mysql_fetch_array($result);
echo "\n<tr><td>\n";
$boxstuff = "";
$boxTitle = "".ifconstant($assnarray[abreviation])."";
$sql="select * from $pntable[yp_assns] where (catid = $category AND regionid = $region) OR (catid = -1 AND regionid = -1) OR (catid = -1 AND regionid = $region) order by abreviation";
$result2=mysql_query($sql);
while ($assnarray = mysql_fetch_array($result2)) {
$boxstuff .= "<input type=checkbox name=assnid$assnarray[catid] value=1> ";
$boxstuff .= "\n<font class=\"pn-normal\">".ifconstant($assnarray[abreviation])."<br>\n";
}
$boxstuff .= "";
$row[title] = $boxTitle;
$row[content] = $boxstuff;
themesidebox($row);
echo "\n</td></tr>\n";
}
}
}
}
?>
</table></td>
</tr>