Hi I'm trying to rearrange my code so I can display my array in 2 columns with each column being <td> cell from each results being a row like I got now.
I want it to calculate the array split in half and put first 50% on left <td> and the other half on the right <td>. Everything I've tried is making rows... Any suggestions?
Code I have now:
define ("NUMCOLS",2);
$count = 0;
$counter= 1;
echo "<table border='0' width='100%'>";
foreach ($result[$Array] as $row) {
if ($count % NUMCOLS == 0) echo "<tr>\n"; # new row
echo '<td width="50%"><a href="$row['ID'].'">'.$row['Name'].'</a></td>';
$count++;
$counter++;
if ($count % NUMCOLS == 0) echo "</tr>\n"; # end row
}
# end row if not already ended
if ($count % NUMCOLS != 0) {
foreach ($result[$FA][$SA] as $row) echo "<td> </td>";
echo "</tr>\n";
}
echo "</table>";
It displays now as:
<tr>
<td>1</td><td>2</td>
<td>3</td><td>4</td>
</tr>
when I need it to be:
<tr>
<td>1<br>2</td><td>3<br>4</td>
</tr>
I just can't get my code to work. thanks.