View Single Post
  #1 (permalink)  
Old November 8th, 2003, 05:41 AM
hosefo81 hosefo81 is offline
Authorized User
 
Join Date: Oct 2003
Location: KL, wilayah persekutuan, Malaysia.
Posts: 91
Thanks: 0
Thanked 0 Times in 0 Posts
Default nested while loop doesn't loop

i has problem looping the second while Loop.It will only loop once.So i can only get the value for the first row for the second loop.Below are my problems area of my code.


while($row1 = mysql_fetch_array($result1))
{
    $cat_id= $row1["category_id"];
    echo " <tr>
        <td>$row1[category_name] </td>";

    while($row2 = mysql_fetch_array($result2))
    {
        if($cat_id==$row2["prod_cat"])
            echo " <td>$row2[Total] </td>";

    }
    echo" </tr>";
}



Reply With Quote