|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-02-10 15:18 UTC] tony2001@php.net
[2006-02-23 01:07 UTC] travis at raybold dot com
[2006-03-08 00:04 UTC] marshmallow007 at hotmail dot com
[2006-03-15 16:03 UTC] wez@php.net
[2006-03-27 23:04 UTC] wez@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Nov 07 06:00:01 2025 UTC |
Description: ------------ On SQL Server 2005 Express (free), using Windows XP, Wamp 1.6.0 (php 5.1.1) and PDO ODBC: With a simple table PDO doesn't return what I expect him to. Might be dued to the mix of varchar and (small, tiny)int. Reproduce code: --------------- create table T ( [A] varchar(80) NOT NULL, [B] tinyint NOT NULL, [C] varchar(100) NOT NULL, [D] smallint NOT NULL, [E] varchar(1024) NOT NULL, [F] varchar(255) NOT NULL, [G] varchar(255) NOT NULL, [H] varchar(1000) NOT NULL, [I] varchar(100) NOT NULL, [J] tinyint NOT NULL, [K] varchar(255) NULL ) insert into T values ('A', '1', 'C', '2', 'E', 'F', 'G', 'H', 'I', '3', 'K') ////////////////////////////////////////////////////////////// try { $db = new PDO('odbc:Driver={SQL Server};Server=HOST\INSTANCENAME;Database=XXXX;', "user", "pass"); } catch( PDOException $e ){ die( $e->getMessage() ); } foreach( $db->query("SELECT * FROM T ", PDO::FETCH_NUM) as $row ) { echo "<pre>"; print_r( $row );echo "</pre>"; } Expected result: ---------------- [0] => A [1] => 1 [2] => C [3] => 2 [4] => E [5] => F [6] => G [7] => H [8] => I [9] => 3 [10] => K Actual result: -------------- [0] => A [1] => 1 [2] => C [3] => 2 [4] => [5] => F [6] => G [7] => [8] => I [9] => 3 [10] => K