Fetch Data While in While Loop using PHP with a MySQL

Description

PHP mysql fetch data with While in While Loop. php While Loop Inside a While Loop Select Data

while loop php mysql fetch data select step wise fetch 

data in mysql while loop

 

fetch data While Loop Inside a While Loop php

get id for one loop and used in 2nd loop

 

$selectloop1 = mysql_query('SELECT * FROM table WHERE main_id = $commentId');

while ($rowsloop1=mysql_fetch_array($resultss1))

{

$commentIdloop = $rowsloop1['id'];

   $repliesloop2 = mysql_query('SELECT * FROM table2 WHERE loop2_id = $commentIdloop');

 

   while ($rowsx=mysql_fetch_array($repliesloop2)){

 

   }

 

}