Home > Article > Backend Development > PHP reads mssql's ntext field and returns an empty value_PHP tutorial
Today when I used PHP to connect to the mssql database, I found that the content of the ntext field could not be displayed. After querying, I found that the ntext field is not supported in PHP. The solution is that we only need to change the ntext field to text.
If there is no ntext field in the table, you can use the following code:
The code is as follows
|
Copy code
|
||||||||||||
// Connect to MSSQL
$link = mssql_connect('KALLESPCSQLEXPRESS', 'sa', 'dsc'); if(!$link || !mssql_select_db('php', $link)) { die('Unable to connect or select database!');
$version = mssql_query('SELECT @@VERSION'); $row = mssql_fetch_array($version);echo $row[0]; // Clean up
?>
| If there is an ntext field in the table and it is difficult to modify it back to the text field, you can do the following:
Open php.ini