Mombu the Php Forum sponsored links

Go Back   Mombu the Php Forum > Php > #38458 : Fails to get values of fields following a MEMO type field in MS Access
User Name
Password
REGISTER NOW! Mark Forums Read

sponsored links


Reply
 
1 26th August 00:45
php-bugs@lists.php.net (costas at meezon dot
External User
 
Posts: 1
Default #38458 : Fails to get values of fields following a MEMO type field in MS Access


From: costas at meezon dot com
Operating system: Windows XP Prof
PHP version: 5.1.4
PHP Bug Type: PDO related
Bug description: Fails to get values of fields following a MEMO type field in MS Access

Description:
------------
I have an MS Access database and use PDO/ODBC. There are 2 MEMO type
columns (notes and notes2) in one table 'tblNotes'.

tblNotes structure
-------------------
LastName - text,
notes - memo,
addr - text,
notes2 - memo
zip - text

I added 2 rows and manually populated all the columns with data. The notes
and notes2 have just a couple of characters each.

Problem:
---------
When I use 'SELECT * from tblNotes' all rows are retrieved, but the values
for all non-MEMO type columns (which follow MEMO columns) are null. This
means addr and zip are NULL but LastName is correct.

If I ********ly name the columns in the SELECT I get the same result (E.g.
SELECT LastName, notes, addr, notes2, zip from tblNotes order by LastName).
This means addr and zip are NULL but LastName is correct.

Workaround:
------------
If I move the notes and notes2 columns to the end, then all the values are
retrieved (E.g. SELECT LastName, addr, zip, notes, notes2 from tblNotes
order by LastName)

This is OK if you have just a few columns. Otherwise you have to type them
all in.

I am not sure if this is a PDO problem or ODBC.

Reproduce code:
---------------
<?php
$tbl='tblNotes';

$user='';
$pass='';
$conn = "DSN=mailing;Driver=Microsoft Access Driver";
try {
$dbh = new PDO("odbc:$conn", $user, $pass);
$cursor=$dbh->query("SELECT * from $tbl order by LastName");
foreach ($cursor as $row) {
$row=array_change_key_case($row, CASE_UPPER);
echo $row['LASTNAME'] . '|';
echo $row['NOTES'] . '|';
echo $row['ADDR'] . '|';
echo $row['NOTES2'] . '|';
echo $row['ZIP'] . '|';
echo "\n";
}
echo "\n";

$cursor1=$dbh->query("SELECT LastName, notes, addr, notes2, zip from
$tbl order by LastName");
foreach ($cursor1 as $row) {
$row=array_change_key_case($row, CASE_UPPER);
echo $row['LASTNAME'] . '|';
echo $row['NOTES'] . '|';
echo $row['ADDR'] . '|';
echo $row['NOTES2'] . '|';
echo $row['ZIP'] . '|';
echo "\n";
}
echo "\n";

$cursor2=$dbh->query("SELECT LastName, addr, zip, notes, notes2 from
$tbl order by LastName");
foreach ($cursor2 as $row) {
$row=array_change_key_case($row, CASE_UPPER);
echo $row['LASTNAME'] . '|';
echo $row['NOTES'] . '|';
echo $row['ADDR'] . '|';
echo $row['NOTES2'] . '|';
echo $row['ZIP'] . '|';
echo "\n";
}

} catch (PDOException $e) {

echo $e->getMessage();

}
$dbh = null;
?>

Expected result:
----------------
For $cursor -- wrong result
doe|mm||nn||
smith|xx||yy||

For $cursor1 -- wrong result
doe|mm||nn||
smith|xx||yy||

For $cursor2 --- Correct result
doe|mm|120 main street|nn|10006|
smith|xx|320 bway|yy|10007|

Actual result:
--------------
See expected results above.

--
Edit bug report at http://bugs.php.net/?id=38458&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=38458&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=38458&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=38458&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=38458&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=38458&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=38458&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=38458&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=38458&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=38458&r=support
Expected behavior: http://bugs.php.net/fix.php?id=38458&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=38458&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=38458&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=38458&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=38458&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=38458&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=38458&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=38458&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=38458&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=38458&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=38458&r=mysqlcfg
  Reply With Quote


  sponsored links


2 26th August 01:43
tony2001
External User
 
Posts: 1
Default #38458 : Fails to get values of fields following a MEMO type field in MS Access


ID: 38458
Updated by: tony2001@php.net
Reported By: costas at meezon dot com
-Status: Open
+Status: Feedback
Bug Type: PDO related
Operating System: Windows XP Prof
PHP Version: 5.1.4
New Comment:

Please try using this CVS snapshot:

http://snaps.php.net/php5.2-latest.tar.gz

For Windows:

http://snaps.php.net/win32/php5.2-win32-latest.zip


Previous Comments:
------------------------------------------------------------------------

[2006-08-15 00:11:36] costas at meezon dot com

Description:
------------
I have an MS Access database and use PDO/ODBC. There are 2 MEMO type
columns (notes and notes2) in one table 'tblNotes'.

tblNotes structure
-------------------
LastName - text,
notes - memo,
addr - text,
notes2 - memo
zip - text

I added 2 rows and manually populated all the columns with data. The
notes and notes2 have just a couple of characters each.

Problem:
---------
When I use 'SELECT * from tblNotes' all rows are retrieved, but the
values for all non-MEMO type columns (which follow MEMO columns) are
null. This means addr and zip are NULL but LastName is correct.

If I ********ly name the columns in the SELECT I get the same result
(E.g. SELECT LastName, notes, addr, notes2, zip from tblNotes order by
LastName). This means addr and zip are NULL but LastName is correct.

Workaround:
------------
If I move the notes and notes2 columns to the end, then all the values
are retrieved (E.g. SELECT LastName, addr, zip, notes, notes2 from
tblNotes order by LastName)

This is OK if you have just a few columns. Otherwise you have to type
them all in.

I am not sure if this is a PDO problem or ODBC.

Reproduce code:
---------------
<?php
$tbl='tblNotes';

$user='';
$pass='';
$conn = "DSN=mailing;Driver=Microsoft Access Driver";
try {
$dbh = new PDO("odbc:$conn", $user, $pass);
$cursor=$dbh->query("SELECT * from $tbl order by LastName");
foreach ($cursor as $row) {
$row=array_change_key_case($row, CASE_UPPER);
echo $row['LASTNAME'] . '|';
echo $row['NOTES'] . '|';
echo $row['ADDR'] . '|';
echo $row['NOTES2'] . '|';
echo $row['ZIP'] . '|';
echo "\n";
}
echo "\n";

$cursor1=$dbh->query("SELECT LastName, notes, addr, notes2, zip
from $tbl order by LastName");
foreach ($cursor1 as $row) {
$row=array_change_key_case($row, CASE_UPPER);
echo $row['LASTNAME'] . '|';
echo $row['NOTES'] . '|';
echo $row['ADDR'] . '|';
echo $row['NOTES2'] . '|';
echo $row['ZIP'] . '|';
echo "\n";
}
echo "\n";

$cursor2=$dbh->query("SELECT LastName, addr, zip, notes, notes2
from $tbl order by LastName");
foreach ($cursor2 as $row) {
$row=array_change_key_case($row, CASE_UPPER);
echo $row['LASTNAME'] . '|';
echo $row['NOTES'] . '|';
echo $row['ADDR'] . '|';
echo $row['NOTES2'] . '|';
echo $row['ZIP'] . '|';
echo "\n";
}

} catch (PDOException $e) {

echo $e->getMessage();

}
$dbh = null;
?>

Expected result:
----------------
For $cursor -- wrong result
doe|mm||nn||
smith|xx||yy||

For $cursor1 -- wrong result
doe|mm||nn||
smith|xx||yy||

For $cursor2 --- Correct result
doe|mm|120 main street|nn|10006|
smith|xx|320 bway|yy|10007|

Actual result:
--------------
See expected results above.


------------------------------------------------------------------------


--
Edit this bug report at http://bugs.php.net/?id=38458&edit=1
  Reply With Quote
3 26th August 05:49
php-bugs@lists.php.net (costas at meezon dot
External User
 
Posts: 1
Default #38458 : Fails to get values of fields following a MEMO type field in MS Access


ID: 38458
User updated by: costas at meezon dot com
Reported By: costas at meezon dot com
-Status: Feedback
+Status: Open
Bug Type: PDO related
Operating System: Windows XP Prof
PHP Version: 5.1.4
New Comment:

I have teste with snapshot as suggested and get the exact same results
(version PHP Version 5.2.0RC2-dev)

Results:
doe|mm||nn2||
smith|xx||yy2||

doe|mm||nn2||
smith|xx||yy2||

doe|mm|120 main street|nn2|10006|
smith|xx|320 bway|yy2|10007|


Previous Comments:
------------------------------------------------------------------------

[2006-08-15 06:41:12] tony2001@php.net

Please try using this CVS snapshot:

http://snaps.php.net/php5.2-latest.tar.gz

For Windows:

http://snaps.php.net/win32/php5.2-win32-latest.zip

------------------------------------------------------------------------

[2006-08-15 00:11:36] costas at meezon dot com

Description:
------------
I have an MS Access database and use PDO/ODBC. There are 2 MEMO type
columns (notes and notes2) in one table 'tblNotes'.

tblNotes structure
-------------------
LastName - text,
notes - memo,
addr - text,
notes2 - memo
zip - text

I added 2 rows and manually populated all the columns with data. The
notes and notes2 have just a couple of characters each.

Problem:
---------
When I use 'SELECT * from tblNotes' all rows are retrieved, but the
values for all non-MEMO type columns (which follow MEMO columns) are
null. This means addr and zip are NULL but LastName is correct.

If I ********ly name the columns in the SELECT I get the same result
(E.g. SELECT LastName, notes, addr, notes2, zip from tblNotes order by
LastName). This means addr and zip are NULL but LastName is correct.

Workaround:
------------
If I move the notes and notes2 columns to the end, then all the values
are retrieved (E.g. SELECT LastName, addr, zip, notes, notes2 from
tblNotes order by LastName)

This is OK if you have just a few columns. Otherwise you have to type
them all in.

I am not sure if this is a PDO problem or ODBC.

Reproduce code:
---------------
<?php
$tbl='tblNotes';

$user='';
$pass='';
$conn = "DSN=mailing;Driver=Microsoft Access Driver";
try {
$dbh = new PDO("odbc:$conn", $user, $pass);
$cursor=$dbh->query("SELECT * from $tbl order by LastName");
foreach ($cursor as $row) {
$row=array_change_key_case($row, CASE_UPPER);
echo $row['LASTNAME'] . '|';
echo $row['NOTES'] . '|';
echo $row['ADDR'] . '|';
echo $row['NOTES2'] . '|';
echo $row['ZIP'] . '|';
echo "\n";
}
echo "\n";

$cursor1=$dbh->query("SELECT LastName, notes, addr, notes2, zip
from $tbl order by LastName");
foreach ($cursor1 as $row) {
$row=array_change_key_case($row, CASE_UPPER);
echo $row['LASTNAME'] . '|';
echo $row['NOTES'] . '|';
echo $row['ADDR'] . '|';
echo $row['NOTES2'] . '|';
echo $row['ZIP'] . '|';
echo "\n";
}
echo "\n";

$cursor2=$dbh->query("SELECT LastName, addr, zip, notes, notes2
from $tbl order by LastName");
foreach ($cursor2 as $row) {
$row=array_change_key_case($row, CASE_UPPER);
echo $row['LASTNAME'] . '|';
echo $row['NOTES'] . '|';
echo $row['ADDR'] . '|';
echo $row['NOTES2'] . '|';
echo $row['ZIP'] . '|';
echo "\n";
}

} catch (PDOException $e) {

echo $e->getMessage();

}
$dbh = null;
?>

Expected result:
----------------
For $cursor -- wrong result
doe|mm||nn||
smith|xx||yy||

For $cursor1 -- wrong result
doe|mm||nn||
smith|xx||yy||

For $cursor2 --- Correct result
doe|mm|120 main street|nn|10006|
smith|xx|320 bway|yy|10007|

Actual result:
--------------
See expected results above.


------------------------------------------------------------------------


--
Edit this bug report at http://bugs.php.net/?id=38458&edit=1
  Reply With Quote
4 26th August 05:49
tony2001
External User
 
Posts: 1
Default #38458 : Fails to get values of fields following a MEMO type field in MS Access


ID: 38458
Updated by: tony2001@php.net
Reported By: costas at meezon dot com
-Status: Open
+Status: Assigned
Bug Type: PDO related
Operating System: Windows XP Prof
PHP Version: 5.1.4
-Assigned To:
+Assigned To: wez


Previous Comments:
------------------------------------------------------------------------

[2006-08-16 14:48:48] costas at meezon dot com

I have teste with snapshot as suggested and get the exact same results
(version PHP Version 5.2.0RC2-dev)

Results:
doe|mm||nn2||
smith|xx||yy2||

doe|mm||nn2||
smith|xx||yy2||

doe|mm|120 main street|nn2|10006|
smith|xx|320 bway|yy2|10007|

------------------------------------------------------------------------

[2006-08-15 06:41:12] tony2001@php.net

Please try using this CVS snapshot:

http://snaps.php.net/php5.2-latest.tar.gz

For Windows:

http://snaps.php.net/win32/php5.2-win32-latest.zip

------------------------------------------------------------------------

[2006-08-15 00:11:36] costas at meezon dot com

Description:
------------
I have an MS Access database and use PDO/ODBC. There are 2 MEMO type
columns (notes and notes2) in one table 'tblNotes'.

tblNotes structure
-------------------
LastName - text,
notes - memo,
addr - text,
notes2 - memo
zip - text

I added 2 rows and manually populated all the columns with data. The
notes and notes2 have just a couple of characters each.

Problem:
---------
When I use 'SELECT * from tblNotes' all rows are retrieved, but the
values for all non-MEMO type columns (which follow MEMO columns) are
null. This means addr and zip are NULL but LastName is correct.

If I ********ly name the columns in the SELECT I get the same result
(E.g. SELECT LastName, notes, addr, notes2, zip from tblNotes order by
LastName). This means addr and zip are NULL but LastName is correct.

Workaround:
------------
If I move the notes and notes2 columns to the end, then all the values
are retrieved (E.g. SELECT LastName, addr, zip, notes, notes2 from
tblNotes order by LastName)

This is OK if you have just a few columns. Otherwise you have to type
them all in.

I am not sure if this is a PDO problem or ODBC.

Reproduce code:
---------------
<?php
$tbl='tblNotes';

$user='';
$pass='';
$conn = "DSN=mailing;Driver=Microsoft Access Driver";
try {
$dbh = new PDO("odbc:$conn", $user, $pass);
$cursor=$dbh->query("SELECT * from $tbl order by LastName");
foreach ($cursor as $row) {
$row=array_change_key_case($row, CASE_UPPER);
echo $row['LASTNAME'] . '|';
echo $row['NOTES'] . '|';
echo $row['ADDR'] . '|';
echo $row['NOTES2'] . '|';
echo $row['ZIP'] . '|';
echo "\n";
}
echo "\n";

$cursor1=$dbh->query("SELECT LastName, notes, addr, notes2, zip
from $tbl order by LastName");
foreach ($cursor1 as $row) {
$row=array_change_key_case($row, CASE_UPPER);
echo $row['LASTNAME'] . '|';
echo $row['NOTES'] . '|';
echo $row['ADDR'] . '|';
echo $row['NOTES2'] . '|';
echo $row['ZIP'] . '|';
echo "\n";
}
echo "\n";

$cursor2=$dbh->query("SELECT LastName, addr, zip, notes, notes2
from $tbl order by LastName");
foreach ($cursor2 as $row) {
$row=array_change_key_case($row, CASE_UPPER);
echo $row['LASTNAME'] . '|';
echo $row['NOTES'] . '|';
echo $row['ADDR'] . '|';
echo $row['NOTES2'] . '|';
echo $row['ZIP'] . '|';
echo "\n";
}

} catch (PDOException $e) {

echo $e->getMessage();

}
$dbh = null;
?>

Expected result:
----------------
For $cursor -- wrong result
doe|mm||nn||
smith|xx||yy||

For $cursor1 -- wrong result
doe|mm||nn||
smith|xx||yy||

For $cursor2 --- Correct result
doe|mm|120 main street|nn|10006|
smith|xx|320 bway|yy|10007|

Actual result:
--------------
See expected results above.


------------------------------------------------------------------------


--
Edit this bug report at http://bugs.php.net/?id=38458&edit=1
  Reply With Quote
5 31st August 05:07
php-bugs@lists.php.net (johnc at inkjetinc dot
External User
 
Posts: 1
Default #38458 : Fails to get values of fields following a MEMO type field in MS Access


ID: 38458
Comment by: johnc at inkjetinc dot com
Reported By: costas at meezon dot com
Status: Assigned
Bug Type: PDO related
Operating System: Windows XP Prof
PHP Version: 5.1.4
Assigned To: wez
New Comment:

I am seeing the same problem accessing MEMO fields in Visual FoxPro
using pdo/odbc in php 5.1.6. I was previusly using php 5.1.1 and did
not encounter this issue in that version (in php 5.1.1 I addeded pdo
maually from the pecl compiled sources).


Previous Comments:
------------------------------------------------------------------------

[2006-08-16 14:48:48] costas at meezon dot com

I have teste with snapshot as suggested and get the exact same results
(version PHP Version 5.2.0RC2-dev)

Results:
doe|mm||nn2||
smith|xx||yy2||

doe|mm||nn2||
smith|xx||yy2||

doe|mm|120 main street|nn2|10006|
smith|xx|320 bway|yy2|10007|

------------------------------------------------------------------------

[2006-08-15 06:41:12] tony2001@php.net

Please try using this CVS snapshot:

http://snaps.php.net/php5.2-latest.tar.gz

For Windows:

http://snaps.php.net/win32/php5.2-win32-latest.zip

------------------------------------------------------------------------

[2006-08-15 00:11:36] costas at meezon dot com

Description:
------------
I have an MS Access database and use PDO/ODBC. There are 2 MEMO type
columns (notes and notes2) in one table 'tblNotes'.

tblNotes structure
-------------------
LastName - text,
notes - memo,
addr - text,
notes2 - memo
zip - text

I added 2 rows and manually populated all the columns with data. The
notes and notes2 have just a couple of characters each.

Problem:
---------
When I use 'SELECT * from tblNotes' all rows are retrieved, but the
values for all non-MEMO type columns (which follow MEMO columns) are
null. This means addr and zip are NULL but LastName is correct.

If I ********ly name the columns in the SELECT I get the same result
(E.g. SELECT LastName, notes, addr, notes2, zip from tblNotes order by
LastName). This means addr and zip are NULL but LastName is correct.

Workaround:
------------
If I move the notes and notes2 columns to the end, then all the values
are retrieved (E.g. SELECT LastName, addr, zip, notes, notes2 from
tblNotes order by LastName)

This is OK if you have just a few columns. Otherwise you have to type
them all in.

I am not sure if this is a PDO problem or ODBC.

Reproduce code:
---------------
<?php
$tbl='tblNotes';

$user='';
$pass='';
$conn = "DSN=mailing;Driver=Microsoft Access Driver";
try {
$dbh = new PDO("odbc:$conn", $user, $pass);
$cursor=$dbh->query("SELECT * from $tbl order by LastName");
foreach ($cursor as $row) {
$row=array_change_key_case($row, CASE_UPPER);
echo $row['LASTNAME'] . '|';
echo $row['NOTES'] . '|';
echo $row['ADDR'] . '|';
echo $row['NOTES2'] . '|';
echo $row['ZIP'] . '|';
echo "\n";
}
echo "\n";

$cursor1=$dbh->query("SELECT LastName, notes, addr, notes2, zip
from $tbl order by LastName");
foreach ($cursor1 as $row) {
$row=array_change_key_case($row, CASE_UPPER);
echo $row['LASTNAME'] . '|';
echo $row['NOTES'] . '|';
echo $row['ADDR'] . '|';
echo $row['NOTES2'] . '|';
echo $row['ZIP'] . '|';
echo "\n";
}
echo "\n";

$cursor2=$dbh->query("SELECT LastName, addr, zip, notes, notes2
from $tbl order by LastName");
foreach ($cursor2 as $row) {
$row=array_change_key_case($row, CASE_UPPER);
echo $row['LASTNAME'] . '|';
echo $row['NOTES'] . '|';
echo $row['ADDR'] . '|';
echo $row['NOTES2'] . '|';
echo $row['ZIP'] . '|';
echo "\n";
}

} catch (PDOException $e) {

echo $e->getMessage();

}
$dbh = null;
?>

Expected result:
----------------
For $cursor -- wrong result
doe|mm||nn||
smith|xx||yy||

For $cursor1 -- wrong result
doe|mm||nn||
smith|xx||yy||

For $cursor2 --- Correct result
doe|mm|120 main street|nn|10006|
smith|xx|320 bway|yy|10007|

Actual result:
--------------
See expected results above.


------------------------------------------------------------------------


--
Edit this bug report at http://bugs.php.net/?id=38458&edit=1
  Reply With Quote
6 2nd September 21:03
wez
External User
 
Posts: 1
Default #38458 : Fails to get values of fields following a MEMO type field in MS Access


ID: 38458
Updated by: wez@php.net
Reported By: costas at meezon dot com
-Status: Assigned
+Status: Closed
Bug Type: PDO related
Operating System: Windows XP Prof
PHP Version: 5.1.4
Assigned To: wez
New Comment:

This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.

Thank you for the report, and for helping us make PHP better.

Fix will show up in the next PHP 5.2 snapshot at snaps.php.net.


Previous Comments:
------------------------------------------------------------------------

[2006-09-22 22:26:38] johnc at inkjetinc dot com

I am seeing the same problem accessing MEMO fields in Visual FoxPro
using pdo/odbc in php 5.1.6. I was previusly using php 5.1.1 and did
not encounter this issue in that version (in php 5.1.1 I addeded pdo
maually from the pecl compiled sources).

------------------------------------------------------------------------

[2006-08-16 14:48:48] costas at meezon dot com

I have teste with snapshot as suggested and get the exact same results
(version PHP Version 5.2.0RC2-dev)

Results:
doe|mm||nn2||
smith|xx||yy2||

doe|mm||nn2||
smith|xx||yy2||

doe|mm|120 main street|nn2|10006|
smith|xx|320 bway|yy2|10007|

------------------------------------------------------------------------

[2006-08-15 06:41:12] tony2001@php.net

Please try using this CVS snapshot:

http://snaps.php.net/php5.2-latest.tar.gz

For Windows:

http://snaps.php.net/win32/php5.2-win32-latest.zip

------------------------------------------------------------------------

[2006-08-15 00:11:36] costas at meezon dot com

Description:
------------
I have an MS Access database and use PDO/ODBC. There are 2 MEMO type
columns (notes and notes2) in one table 'tblNotes'.

tblNotes structure
-------------------
LastName - text,
notes - memo,
addr - text,
notes2 - memo
zip - text

I added 2 rows and manually populated all the columns with data. The
notes and notes2 have just a couple of characters each.

Problem:
---------
When I use 'SELECT * from tblNotes' all rows are retrieved, but the
values for all non-MEMO type columns (which follow MEMO columns) are
null. This means addr and zip are NULL but LastName is correct.

If I ********ly name the columns in the SELECT I get the same result
(E.g. SELECT LastName, notes, addr, notes2, zip from tblNotes order by
LastName). This means addr and zip are NULL but LastName is correct.

Workaround:
------------
If I move the notes and notes2 columns to the end, then all the values
are retrieved (E.g. SELECT LastName, addr, zip, notes, notes2 from
tblNotes order by LastName)

This is OK if you have just a few columns. Otherwise you have to type
them all in.

I am not sure if this is a PDO problem or ODBC.

Reproduce code:
---------------
<?php
$tbl='tblNotes';

$user='';
$pass='';
$conn = "DSN=mailing;Driver=Microsoft Access Driver";
try {
$dbh = new PDO("odbc:$conn", $user, $pass);
$cursor=$dbh->query("SELECT * from $tbl order by LastName");
foreach ($cursor as $row) {
$row=array_change_key_case($row, CASE_UPPER);
echo $row['LASTNAME'] . '|';
echo $row['NOTES'] . '|';
echo $row['ADDR'] . '|';
echo $row['NOTES2'] . '|';
echo $row['ZIP'] . '|';
echo "\n";
}
echo "\n";

$cursor1=$dbh->query("SELECT LastName, notes, addr, notes2, zip
from $tbl order by LastName");
foreach ($cursor1 as $row) {
$row=array_change_key_case($row, CASE_UPPER);
echo $row['LASTNAME'] . '|';
echo $row['NOTES'] . '|';
echo $row['ADDR'] . '|';
echo $row['NOTES2'] . '|';
echo $row['ZIP'] . '|';
echo "\n";
}
echo "\n";

$cursor2=$dbh->query("SELECT LastName, addr, zip, notes, notes2
from $tbl order by LastName");
foreach ($cursor2 as $row) {
$row=array_change_key_case($row, CASE_UPPER);
echo $row['LASTNAME'] . '|';
echo $row['NOTES'] . '|';
echo $row['ADDR'] . '|';
echo $row['NOTES2'] . '|';
echo $row['ZIP'] . '|';
echo "\n";
}

} catch (PDOException $e) {

echo $e->getMessage();

}
$dbh = null;
?>

Expected result:
----------------
For $cursor -- wrong result
doe|mm||nn||
smith|xx||yy||

For $cursor1 -- wrong result
doe|mm||nn||
smith|xx||yy||

For $cursor2 --- Correct result
doe|mm|120 main street|nn|10006|
smith|xx|320 bway|yy|10007|

Actual result:
--------------
See expected results above.


------------------------------------------------------------------------


--
Edit this bug report at http://bugs.php.net/?id=38458&edit=1
  Reply With Quote


  sponsored links


Reply


Thread Tools
Display Modes




Copyright 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
666