Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PHP query not returning proper number of rows.

Status
Not open for further replies.

LinnCounty

Programmer
May 30, 2008
5
0
0
US
I have a PHP script that connects to our IBM DB2 Server (as400).

When I run
$query = "SELECT COUNT(row) FROM table";
$execute = odbc_exec($conn,$query);
$result = odbc_fetch_array($execute);
I get a response of 6611.

but when I run
$query = "SELECT row FROM table";
$execute = odbc_exec($con,$query);
while(odbc_fetch_array($execute)) {
$count ++;
}
I only get 3406.


What gives???? It seems if the count() is lower then the $count is closer but never the same..
please help!!


I've done a
while ($r < $row) {
odbc_fetch_into($data,$execute,$r);
$r++;
}
And this works, but is VERY VERY VERY SLOW, and times out if more than a few thousand results.
 
I had an older release of the iSeries Client on my Webserver, so I updated it to the latest (v5r4) which updated the ODBC drive, and viola.. works great.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top