Try this below for getting columns. This is a full EXAMPLE. I usually use a database object that wraps all these functions so that I can use same object to interchange between MSSQL and MySQL. But below is a starter example that you can use to see how it works.
============================================ ## assuming you are already connected, then do this: $query = "select * from users"; $result = mssql_query($query); if ( $result != 0 ) { $numrows = mssql_num_rows($result); if ( $numrows > 0 ) $numfields = mssql_num_fields($result); $table = "<table>"; $table .= "<tr>"; # this line will display column names for( $i=0 $i < $numfields; $i++ ) { $columnName = mssql_field_name( $result, $i ); $table .= "<td><b>" . $columnName . "</b></td>"; # the column rows; } $table .= "</tr>"; # this line displays all the row data while( $row = mssql_fetch_array($result) ) $table .= "<tr>"; # starts a new row for( $i=0 $i < $numfields; $i++ ) { $table .= "<td>" . $row[$i] . "</td>"; # this line is one cell of the data of row; the loop generates the whole record } $table .= "</tr>"; # ends the row } $table .= "</table>"; # the table is complete echo $table; # print out the table } else { echo "The query was successful, but no data was returned. <br>"; } } else { echo "Error running query: $query <br>"; } ============================================ Good luck, Nicole Amashta www.aeontrek.com ---------------------------------- "Chris" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I can get my tables from my DB but how can i get column names displayed > above the result? > > Chris > > -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php