Why does the foreach output name appear double (PS has only two fields)
<?
for($iCnt2 = 0; $iCnt2 < sqlsrv_num_fields($result); $iCnt2++) {
foreach( sqlsrv_field_metadata( $result) as $v ){
echo "<td align=center>". $v['Name']."</td>" ;
}
}
?>
Using foreach to traverse in a for loop is equivalent to looping the traversal again. You can know the difference between for and foreach in Baidu.