Hello, I am trying to print the contents of a database into a 2 row table. I have it working, and it prints in both rows, but the problem that I am having is that it skips the first entry. Here is my code:
$j = 1;
while($data = mysql_fetch_array($result)) {
$id = $data["id"];
$company = $data["company"];
if($j == 1) {
echo "\t<tr>\n";
echo "\t\t<td bgcolor=\"#dcdcdc\"><font face=\"Tahoma, Arial, sans-serif\" size=\"2\"><input type=\"checkbox\" name=\"$id\" value=\"$company\"> $company</font></td>\n";
$j = 2;
}
elseif($j == 2) {
echo "\t\t<td bgcolor=\"#dcdcdc\"><font face=\"Tahoma, Arial, sans-serif\" size=\"2\"><input type=\"checkbox\" name=\"$id\" value=\"$company\"> $company</font></td>\n";
echo "\t</tr>\n";
$j = 1;
}
}
Just before that I have it connect to the database, yada yada. I have the output of the database, but not where $id = 1. When I just try to echo $id, it gives me 2 - 49 not 1 either. Any ideas?
Thanks,
Jacob Ham