This is related to previous thread but the topic has changed.
I have 2 while loops:
while($rowplay=mysql_fetch_array($resultplay))
within this loop is:
while ($rowpkg=mysql_fetch_array($resultpkg))
The records in the $resultplay comes from a table 'Plays' with a primary key(playid)
The records from $resultpkg comes from a table that has no Primary Key. The table has a M-M relationship with a 'Package' table and to the 'Plays' table. The package table has a Primary key (pkgid) that occurs one or more times in the 'pkg_items' table. This is also true for playid. The playid may occur many times in the table but only ONCE when associated with a specific pkgid.
With the above said here is the code for the loops and echoed output to check data:
while($rowplay=mysql_fetch_array($resultplay))
{
echo $rowplay['playid']."=playid from 'play' table.<br>";
while ($rowpkg=mysql_fetch_array($resultpkg))
{
echo $rowpkg['playid']."= Playid in 'pkg-items'<br>";
}
The output is:
8=playid from 'play' table.
8= Playid in pkg-items
2= Playid in pkg-items
4= Playid in pkg-items
2=playid from 'play' table.
4=playid from 'play' table.
7=playid from 'play' table.
9=playid from 'play' table.
10=playid from 'play' table.
As you can see there are no loops within items 2, 4, 7, 9, & 10 in the play table.
Why does the inner loop only work once?