note 86710 added to pdostatement.fetchall
| From: | mrshelly at hotmail dot com | Date: | Fri, 31 Oct 2008 03:27:33 +0000 |
| Subject: | note 86710 added to pdostatement.fetchall | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-145987@lists.php.net to get a copy of this message | ||
PHP fetchAll Data From SQL Server 2005
if field's data type is varchar(nvarchar), only fetch 255 chars. but the "text" data
type is ok.
so, notice! to change the 'varchar' or 'nvarchar' (length > 255) to
'text' data type..
hope to help u.
<?php
$user = 'sa';
$pass = 'pass';
$conn = new PDO('mssql:host=127.0.0.1; dbname=tempdb;', $user, $pass);
$mainSQL = "SELECT field_varchar, field_text FROM table1";
$sth = $conn->prepare($mainSQL);
$sth->setFetchMode(PDO::FETCH_ASSOC);
$sth->execute();
$retRows = $sth->fetchAll();
// the field_varchar field only to fetch 255 chars(max)
// the field_text is ok.
var_dump($retRows);
unset($sth); unset($conn);
?>
----
Server IP: 210.51.44.91
Probable Submitter: 125.83.34.141
----
Manual Page -- http://www.php.net/manual/en/pdostatement.fetchall.php
Edit -- https://master.php.net/note/edit/86710
Del: integrated -- https://master.php.net/note/delete/86710/integrated
Del: useless -- https://master.php.net/note/delete/86710/useless
Del: bad code -- https://master.php.net/note/delete/86710/bad+code
Del: spam -- https://master.php.net/note/delete/86710/spam
Del: non-english -- https://master.php.net/note/delete/86710/non-english
Del: in docs -- https://master.php.net/note/delete/86710/in+docs
Del: other reasons-- https://master.php.net/note/delete/86710
Reject -- https://master.php.net/note/reject/86710
Search -- https://master.php.net/manage/user-notes.php