title: Undefined index error for the last element of array
body: <p>Undefined index for the last element of array while fetching data from a database into an array variable. I use a for loop to seperate and also in_array()... kindly help pls...</p>
  
  <pre><code>include("includes/global_inc.php");
  
  $qry1=$_REQUEST['qry'];
  $feilds2=$_REQUEST['fields1'];
  $cnt=$_REQUEST['count'];
  $feild_name=explode(",",$feilds2);
  $iquery=mysql_query("$qry1") or die(mysql_error());
  
  echo "&lt;table border='1'&gt;";
  echo "&lt;tr&gt;";
  for($i=0;$i&lt;$cnt;$i++) {
  echo "&lt;th&gt;".$feild_name[$i]."&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/th&gt;";
  
  }
  
  echo "&lt;/tr&gt;";
  
  for($g=0;$g&lt;$cnt;$g++) {
      while($test=mysql_fetch_array($iquery)) {
          echo "&lt;tr align='center'&gt;";
                echo"&lt;td&gt;&lt;font color='black'&gt;".$test[$feild_name[$g]]."&lt;/font&gt;&lt;/td&gt;";
            echo"&lt;/tr&gt;";
        }
  
    }
  
  echo "&lt;/table&gt;";
  </code></pre>