简体   繁体   English

PHP ODBC SELECT返回不完整字段

[英]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.

相关问题 使用php脚本运行时,带有where子句的oracle选择查询返回不完整的记录 - oracle select query with where clause returns incomplete record when run using php script PHP DOMDocument getElementsByTagName返回不完整的元素? - PHP DOMDocument getElementsByTagName returns incomplete elements? php-odbc选择X IN位置(选择…) - Php - odbc Select Where X IN (Select…) PHP OpenEdge ODBC不返回字段名称 - PHP OpenEdge ODBC not returning field names PHP Memcached对存储值进行反序列化将返回__PHP_Incomplete_Class - PHP Memcached unserialization of stored value returns __PHP_Incomplete_Class PHP:[Microsoft] [ODBC Microsoft Access驱动程序]查询中的语法错误。 不完整的查询子句 - PHP: [Microsoft][ODBC Microsoft Access Driver] Syntax error in query. Incomplete query clause PHP ODBC 到 HANA/SAP 返回的结果少于预期 - PHP ODBC to HANA/SAP returns less results than expected 对于大型nvarchar,PHP ODBC_FETCH_INTO返回null - PHP ODBC_FETCH_INTO returns null for large nvarchar 通过 PHP 中的 ODBC(使用 PDO)查询 Snowflake 返回不正确的数据 - Querying Snowflake via ODBC (using PDO) in PHP returns incorrect data odbc_exec() 在 False 情况下返回类型(odbc 结果)的资源(3)php 访问 - odbc_exec() returns resource(3) of type (odbc result) in False situation php access
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM