I'm trying to turn this while loop into a for loop and am unable to get my result set to display properly in the for loop. The while works fine I just want to be able to have more control over which information is shown in my table as I loop and was wanting to use a for loop that way I can take advantage of the counter variable while i"m displaying my information. Any help would be appreciated.
while ($row = mysql_fetch_assoc($data_result_set)) {
echo "<td>".$row["product_id"]."</td>";
echo "<td>".$row["city"]."</td>";
echo "<td>".$row["quantity"]."</td>";
}
*** I'm wanting it to look like something like this but can't figure out how to properly work in which row to display with the $i variable.
$count=mysql_num_rows($data_result_set);
for($i = 0; $i <= $count; $i++){
echo "<td>".mysql_fetch_assoc[$i]["product_id"]."</td>";
echo "<td>".mysql_fetch_assoc[$i]["city"]."</td>";
echo "<td>".mysql_fetch_assoc[$i]["quantity"]."</td>";
}
I know the syntax for the for loop is totally off with the method mysql_fetch_assoc just dropped in there like a jerk but I'm just kinda pseudoing it out.
Any help would be appreciated.
Thanks in advance.