[英]PHP ODBC SELECT returns incomplete field
I've migrated a database from MS SQL 2005 (Windows Server 2003) to MS SQL 2012 (windows Server 2012 R2). 我已将数据库从MS SQL 2005(Windows Server 2003)迁移到MS SQL 2012(Windows Server 2012 R2)。 Everything is working well except one thing. 除了一件事,一切都运转良好。
Whenever I try in PHP with ODBC to get a specific column (unfortunately named "text") and the field has a big content, the result is incomplete. 每当我在PHP中使用ODBC尝试获取特定的列(不幸的是命名为“文本”)并且该字段包含大量内容时,结果都是不完整的。 some of the Content's missing, just not existent. 一些内容的丢失,只是不存在。 If I try the SQL command in SQL Management Studio, the result is correct. 如果我在SQL Management Studio中尝试使用SQL命令,则结果是正确的。
I've tried it with the following two methods (same result): 我已经尝试了以下两种方法(结果相同):
$query = odbc_exec ($dbh, "SELECT * FROM artikel WHERE id = '$page'");
if ($data = odbc_fetch_array($query)) {
extract($data);
echo $text;
}
//Method 2 is near the same but with the following SQL command and with odbc_result instead of extract();
SET textsize 2147483647 SELECT text FROM artikel WHERE id = '$page'
Found the solution (thanks to @Álvaro González) I added the following two lines to the code (after odbc_exec()) 找到解决方案(由于@ÁlvaroGonzález),我在代码中添加了以下两行(在odbc_exec()之后)
odbc_binmode($query, ODBC_BINMODE_PASSTHRU);
odbc_longreadlen($query, 16384); //Set the length of the displayed value to 16384
Thanks everyone for help 谢谢大家的帮助
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.