Adding coloum at end of loop
Posted: Mon Oct 23, 2006 10:52 am
Hi sorry another problem
This is hard to explain...
I have a while loop creating a table containing all my fields this part below checks if it is the last row of the field before the while loop ends to start the next field. so basicly its just adding a check box to every row of the table
this checks if the loop count $i is the last one by checking with num_fields but i have had to take one away from the num count not sure why as i thought the last $i should be the same number as the num_field count is this someting to do with the $i starting at 0 not 1.
Anyway heres the problem this works fine but as soon as i get 5 it doesnt add the column i have no idea why
thanks reece
This is hard to explain...
I have a while loop creating a table containing all my fields this part below checks if it is the last row of the field before the while loop ends to start the next field. so basicly its just adding a check box to every row of the table
Code: Select all
echo $i;
$fields=mysql_num_fields($result);
$newfield=$fields-1;
echo "<strong>$newfield</strong>";
if ($i==$newfield)
{
echo "<td bgcolor='#C1C1C1'>";
?>
<input name="checkbox[]" type="checkbox" id="checkbox[]" value="<? echo $row['0']; ?>">
<?
echo "</td>";
}Anyway heres the problem this works fine but as soon as i get 5 it doesnt add the column i have no idea why
thanks reece