php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #19871 Query returning all the same data
Submitted: 2002-10-11 13:41 UTC Modified: 2002-11-15 18:07 UTC
From: keimdf at softek-net dot com Assigned:
Status: Not a bug Package: ODBC related
PHP Version: 4.2.3 OS: W2K Terminal Server
Private report: No CVE-ID: None
 [2002-10-11 13:41 UTC] keimdf at softek-net dot com
I am running a Progress Database with a ODBC data source entry.  I have a test table with 4 records in it.  Each record has three fields.  ID, Name and Total.  The information in the table is... Index on Name.
ID Name  Total
1  Horse  21
2  Cow    30
3  Eagle  14
2  Cow    34

Here is my actual code.

$DBName = "php";
$TableName = "PUB.table1";
$Query = "SELECT * from $TableName";
$Link = odbc_connect ($DBName,$User,$Password);
$Results = odbc_do($Link, $Query);
print odbc_result_all($Results);

What I expect to see was four lines of data display as above.  What I got was...
ID Name Total 
2  Cow   30 
2  Cow   30 
2  Cow   30 
2  Cow   30 

I have tried 10-15 different ways to access the $Results to no avail.  

Then I decided to see if it was SQL problem.  Using another SQL interface to the Progress Database, I performed the same query and got the expected results.  Next I decided to see if it was an ODBC problem.  My first approach was to set up a query within a MSExcel spreadsheet.  This worked just fine and got the expected results.  This told me that the ODBC driver used to access the Progress Database was working.

Next I wanted to see if it was an PHP/ODBC command problem.  So I set up an MS Access database and created an ODBC entry for it using the Microsoft driver for ODBC/mdb.  I got the expected results.  In fact the only difference between the php script for MS Access and Progress was the name of the Data Source.  I also didn't need to use "PUB" in front of the table name.  I used the exact same code to query and print the results.  

This leads me to believe that the problem here is the interaction of php and the driver for Progress.  The ODBC driver that is shipped with Progress is 
MERANT 3.60 32-BIT Progress SQL92 v9.1C  3.60.00.00

Again, everything points to a problem between php and the driver for Progress.  Using the same driver in both Excel, MS Word works just fine.

I would appreciate it if someone would look into this for me.

Thanks

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-11-15 18:07 UTC] kalowsky@php.net
Okay I'm going to assume that you're using the MS ODBC system, which is why the Access and Excel checks worked just fine.  Given that nothing has changed base code wise, it suggests to me that the ODBC Driver for Progress is faulty and not PHP in this case.  

You can turn on SQL Logging to check if PHPs ODBC calls are sending the right requests.   Marking this as bogus because if it works with 2 databases using the same ODBC Driver, and the third doesn't, it seems highly likely #3s implementation of ODBC isn't fully there.
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Sun May 22 19:03:48 2022 UTC