mssql php can't select field type nvarchar(MAX)

北城余情 提交于 2019-12-25 00:41:36

问题


I use this code to select password field from the sql server 2012 db, and does not return any data I tried to change the field type and it did work actually I can't change the field type in the main server and I need to work with it as it is

any idea how to work around it?

<?php
$objConnect = mssql_connect("localhost:1434\MSSQLSERVER","fdi","fdifdi");

if($objConnect)  
{  
echo "Database Connected.<br />";  
mssql_select_db('Intranett', $objConnect);
$query = mssql_query('SELECT  [pass] FROM [Intranett].[dbo].[v24Brukere]');

// Check if there were any records
if (!mssql_num_rows($query)) {
    echo 'No records found';
} else {
    // Print a nice list of users in the format of:
    // * name (username)

    echo '<ul>';

    while ($row = mssql_fetch_object($query)) {
        echo '<li>' . $row->pass .' </li>';
    }

    echo '</ul>';
}

}  
else  
{  
echo "Database Connect Failed.<br />";  
echo mssql_get_last_message();
}  

mssql_close($objConnect);  
?>  

回答1:


As far as I know, NVARCHAR is not supported with the old and long outdated mssql-drivers. You should instead use Microsoft's SQL Server Driver for PHP.



来源:https://stackoverflow.com/questions/11095379/mssql-php-cant-select-field-type-nvarcharmax

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!