This snippet of code calls from 2 MySQL tables, cargo and cargo_types related by cargo_id. It displays fine in one single column but I am having problems figuring out how to display the output in two columns.
[]Flatbed []Flatbed w/tarp
[]Flatbed w/sides []Container
[]Tanker []Bulk
<?
$result = mysql_query("select * from cargo_types");
$row = mysql_fetch_array($result);
?>
<table width="600" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<? do {
$cargo_type = $row["cargo_id"];
/ find all records that have already been checked /
$checkedresults = mysql_query("Select * from cargo where uid='$uid' AND cargo_id = '$cargo_type'");
$num = mysql_num_rows($checkedresults);
/ if a record has already been checked append "checked" to the end of the input tag in the html /
if ($num==1) {
$cargo_type = str_replace($cargo_type, "$cargo_type checked", $cargo_type);
}
printf ("<input type=\"checkbox\" name=\"cargo[]\" value=%s>%s</input><br>\n",
$cargo_type, $row['value']);
} while ($row = mysql_fetch_array($result));
?>
</TD>
</TR>
</TABLE>