Hi guys
Ive created a piece of software to extract data from 2 fields in an mssql table, and using php translate them into a graph. Im now trying to extract the field names as titles for my axes. I'm using sqlsrv_query s and have retreived data from the table no problem, however I am finding it difficult to get field names.
I have tried the code:
$result = sqlsrv_query($conn, "SELECT Column_Name FROM information_schema.columns where table_name = 'timeSightings'");
$row = sqlsrv_fetch_array($result);
while($row = sqlsrv_fetch_array( $result ))
{
Print "<b><br>name of column one:</b> ".$row[0] . " ";
Print "<b><br>name of column two:</b> ".$row[1] . " <br>";
}
output:
name of column one: sightings
name of column two:
There are 2 errors in the output
1: column one name should be 'time' and column 2 should be 'sightings'
2: only 1 column name is displayed
Any ideas how to do this?
Thanks, David