[Solved] php nested while loop. Inner loop works only once [closed]


I think you need to re-query res2 inside the outer loop, or at least reset the pointer. The second time through the outer loop you have nothing left in res2, since you’ve already reached the end

In addition, with would be a lot more efficient if you setup the res2 query inside the outer loop and add a where clause so that you are only matching the category ID from the current row in res1.

Hope this helps.

solved php nested while loop. Inner loop works only once [closed]