I keep getting an undefined offset 21 on with this code: any suggestions?
if (mysql_num_rows($result) > 0) {
echo "<table cellpadding=1 border=1>";
while($row = mysql_fetch_row($result)) {
echo "<tr>";
for ($i = 0; $i <= $f; $i++){
echo "<td>";
echo $row[$i]; <--Error Line
echo "</td>";
}
echo "</tr>";
}
echo "</table>";
}
else {
echo "No Rows Found!";
}
echo $i."found";
mysql_free_result($result);
for loop problem
Moderator: General Moderators
Please use tages when posting.
In your loop you have a variable named 'f' not i.
In your loop you have a variable named 'f' not i.
Code: Select all
for ($i = 0; $i <= $f; $i++){Code: Select all
for ($i = 0; $i <= $i; $i++){Code: Select all
$f = mysql_num_fields($result);- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
or just simple do:
Code: Select all
for($i = 0; $i < $f; $i++)