title: Nested While Loop with mysql_fetch_array is giving blank results
body: <p>I have used following code, Please solve any error if exist</p>
  
  <p>I am trying to catch Category name from category table using parentID from Subcategory table</p>
  
  <p>here is the code</p>
  
  <pre><code>$query_select = "SELECT * FROM subcategory where parentID&lt;&gt;0 and isDisabled=0 and isDeleted=0";
  $result_select = mysql_query($query_select) or die(mysql_error());
  $rows = array();
  while($row = mysql_fetch_array($result_select))
    $rows[] = $row;
  
  foreach($rows as $row){ 
    $id = $row['subcatID'];
    $subname = $row['subcatName'];
    $parentID= $row['parentID'];
    $status = $row['isDisabled'];
    $catname="";
    echo "&lt;tr&gt;&lt;td style='display:none;'&gt;$id&lt;/td&gt;";
    echo "&lt;td&gt;&lt;center&gt;$subname&lt;/center&gt;&lt;/td&gt;";
    $resultnew=mysql_query("select catName from category where catID=$parentID");
  
    while(mysql_fetch_row($resultnew)){
      $catname = $resultnew[0];
      echo "&lt;script&gt;alert($catname);&lt;/script&gt;";
      echo "&lt;td class='center'&gt;&lt;center&gt;$catname&lt;/center&gt;&lt;/td&gt;";
    }
    if($status==0)
      {
        echo "&lt;td class='center'&gt;&lt;center&gt;&lt;span class='label label-success'&gt;Active&lt;/span&gt;&lt;/center&gt;&lt;/td&gt;";
      }else{
      echo "&lt;td class='center'&gt;&lt;center&gt;&lt;span class='label label-important'&gt;Disabled&lt;/span&gt;&lt;/center&gt;&lt;/td&gt;";
    }
    echo "&lt;td class='center'&gt;&lt;center&gt;";
    echo "&lt;a class='btn btn-success' href='#'&gt;&lt;i class='icon-zoom-in icon-white'&gt;&lt;/i&gt;View&lt;/a&gt;";
    echo "&lt;a class='btn btn-info' href='#'&gt;&lt;i class='icon-edit icon-white'&gt;&lt;/i&gt;Edit&lt;/a&gt;";
    echo "&lt;a class='btn btn-danger' href='#'&gt;&lt;i class='icon-trash icon-white'&gt;&lt;/i&gt;Delete&lt;/a&gt;";
    echo "&lt;/center&gt;&lt;/td&gt;";
    echo "&lt;/tr&gt;";
  }
  </code></pre>