Reputation: 933
Working on converting my code from mysql to sqlsrv. Wondering what the equivalent for mysql_field_type
, hopefully someone knows of a page where I can see more mysql and sql equivalent functions. Cant either find for these two:
mysql_field_name
mysql_fetch_row
Upvotes: 1
Views: 777
Reputation: 1384
These are PHP functions for MySQL. Similarly, there are functions for MS SQL Server too.
Ex:
mssql_field_type
mssql_field_name
mssql_fetch_row
Please check the PHP for MS SQL Server manual here(http://www.php.net/manual/en/book.mssql.php) for the complete list of functions.
UPDATE:
I had assumed the question to be a question related to SQL Server and accordingly tried to provide a solution for SQL Server. However, as now I have realized that it is a sqsrv question, here is the solution.
We can extract the details of field through sqlsrv_field_metadata function.
Example:
$sql = "SELECT * FROM Table_1";
$stmt = sqlsrv_prepare( $conn, $sql );
foreach( sqlsrv_field_metadata( $stmt ) as $fieldMetadata ) {
foreach( $fieldMetadata as $name => $value) {
echo "$name: $value<br />";
}
echo "<br />";
}
For other functions and detailed examples, please check the PHP sqlsrv manual here
Upvotes: 2