PHP Development Resources

PHP returning wrong values for long fields

PHP has a default setting on the php.ini file to control the maximum size of returned fields. The default is:

odbc.defaultlrl = 4096


Any varchar (for example) longer than that value will return the first 4096 characters and, in some cases, random values to the field size.

The fix is set this value longer than the expected maximum length.

The PHP functions odbc_binmode (for binary data) and odbc_longreadlen can used to set this on a per statement basis.


Referenced by...