|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-01-26 11:28 UTC] edink@php.net
[2005-01-26 11:34 UTC] kevin dot bray at utoronto dot ca
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Dec 04 08:00:01 2025 UTC |
Description: ------------ When using pg_fetch_result to obtain field values (in this case, strings), PHP seems to print/echo only the first character in the value, I'm working with the following table (forgive the odd test values): arkhiv=# select * from docsender; doctitle | sender ------------------------------+---------- letter about cheese | bob letter about cheese | george note about peas | helen note about peas | god note about peas | bob Reproduce code: --------------- // pg_connect() code omitted above $result = pg_query("SELECT docSender.sender FROM docSender WHERE docSender.doctitle = 'letter about cheese'"); ?> <table> <? $loopCount=0; $rowCount = pg_num_rows($result); while ($loopCount < $rowCount){ $send = pg_fetch_result($result, $loopCount, 0); ?> <tr> <td> <? print 'Author: ' . $send['sender']; ?> </td> <td> <? var_dump($send); ?> </td> </tr> <? $loopCount++; } //endwhile ?> </table> Expected result: ---------------- I expected to see this: -------------------------------------------- <html> <table> <tr> <td> Author: bob</td> <td> string(3) "bob" </td> </tr> <tr> <td> Author: george</td> <td> string(6) "george" </td> </tr> </table></body> </html> Actual result: -------------- Only the initial characters (ie, 'b' and 'g') of 'bob' and 'george' appeared in the first <td> fields: --------------------------------------------- <html> <table> <tr> <td> Author: b </td> <td> string(3) "bob" </td> </tr> <tr> <td> Author: g </td> <td> string(6) "george" </td> </tr> </table></body> </html> --------------------------------------------- I inserted "var_dump();" to check if postgres was returning the entire value of the field. Apparently it is, so the shortened string must result from a later (ie PHP) problem. Thank you for your attention.