我使用此代码从sql server 2012 db中选择密码字段,并且不返回任何数据 我试图改变字段类型,它确实有效 实际上我无法更改主服务器中的字段类型,我需要使用它,因为它是
任何想法如何解决它?
<?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);
?>
答案 0 :(得分:1)
据我所知,旧的和久已过时的mssql-drivers不支持NVARCHAR
。您应该使用Microsoft's SQL Server Driver for PHP。