mssql_fetch_array question
I was wondering if when I am using mssql_fetch_array if even though I
am stepping through '
the array using index numbers is there a way to also get the field
name (IE the associative array key)
IE
$row = mssql_fetch_array($result)
echo $row[1] ;
echo $row[1]['filedname']; <-this would be the actual sql field name?
$link = mssql_connect("sql.site.com:9999/Engineering", "username",
"password");
mssql_select_db('beaver_research', $link) or die ('Could not
select to beaver_college database');
$sql="SELECT * from person order by personid";
$result = mssql_query($sql, $link);
//$rows = mssql_fetch_array($result);
foreach ($rows as $row_num => $row)
{
echo $row."<br>\n";
}
echo "<person>";
while($row = mssql_fetch_array($result))
{
//echo("$row[0]<br>");
for ( $counter = 0; $counter <= 9; $counter += 1)
{
echo "<".$row[$counter]['name'].">".$row[$counter]."</".$row[$counter]
['name'].">\n";
if ($row[$counter]=='') echo ".";
}
echo "</person>";
|