PHP中的MSSQL查询问题和查询文本数据 [英] MSSQL Query issue in PHP and querying text data
本文介绍了PHP中的MSSQL查询问题和查询文本数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用PHP查询以连接和从MSSQL EXPRESS(2008 R2)数据库中提取数据.但是当我从数据库中提取基于ntext的数据时出现错误.
I'm trying a query in PHP to connect and extract data from a MSSQL EXPRESS (2008 R2) database. But i'm getting an error when i'm pulling ntext based data from the DB.
错误是;
仅Unicode归类或ntext数据中的Unicode数据无法使用DB-Library(例如ISQL)或ODBC 3.7或更早版本发送给客户端. (严重级16)在
Unicode data in a Unicode-only collation or ntext data cannot be sent to clients using DB-Library (such as ISQL) or ODBC version 3.7 or earlier. (severity 16) in
我的脚本是
$myServer = ".\SQLEXPRESS";
$myUser = "sa";
$myPass = "blablabla";
$myDB = "test";
//connection to the database
$dbhandle = mssql_connect($myServer, $myUser, $myPass)
or die("Couldn't connect to SQL Server on $myServer");
//select a database to work with
$selected = mssql_select_db($myDB, $dbhandle)
or die("Couldn't open database $myDB");
//declare the SQL statement that will query the database
$query = "SELECT * FROM dbo.table WHERE query='2'";
//$query .= "FROM dbo.table ";
//$query .= "WHERE query='2'";
//execute the SQL query and return records
$result = mssql_query($query);
$numRows = mssql_num_rows($result);
echo "<h1>" . $numRows . " Row" . ($numRows == 1 ? "" : "s") . " Returned </h1>";
//display the results
while($row = mssql_fetch_array($result))
{
echo "<li>" . $row["query"]. "</li>";
}
//close the connection
mssql_close($dbhandle);
对此有任何帮助,感激不尽....
any help on this is appreciated ....
谢谢....
推荐答案
查看全文