dfordinal Posted June 12, 2009 Share Posted June 12, 2009 I have a program written in PHP on a Linux Fedora 10 system. I am running a query that retrieves all the records from a table in a DB2 database running on an IBM iSeries server. I am using ODBC_Connect to get the data. The driver is IBM DB2 ODBC Driver v2.2.12. Around 94,000 records are being returned in the query with 15 being displayed on a page at a time. The data is being displayed in a table with basic info from each record. When I have more than 32,767 records the 32,767th record begins replacing every other row after it is displayed in the table. For example. I have the following records: recordid = 32765, name=client 765; recordid = 32766, name=client 766; recordid 32767, name client 767; recordid 32768, name client 768; recordid 32769, name client 769; etc. When they are displayed in the table you will have: Record ID Name 32765 Client 765 32766 Client 766 32767 Client 767 32768 Client 768 32767 Client 767 32770 Client 770 32767 Client 767 You'll notice that record #s 32769 abd 32771 are not displayed, 32767 has replaced them. This will continue for every other succeeding row in the result set. Every other row in the result set is replaced with the data for record 32767. I am using the following PHP code to get at the records. xx is incremented by 15 each sucessive page that is called and $rowNum specifies at which record number to begin showing the results on the page: sqlQuery = “SELECT * FROM UserTable”; sqlQuery .= " FETCH FIRST xx ROWS ONLY"; $resultset = odbc_exec($odbcConn, $sqlQuery); while ($row = odbc_fetch_array($resultset, $rowNum)){ displayRowAssoc($row); $rowNum++; } Does anyone know if this could be a problem with ODBC, PHP, DB2, a combination of the 3....? I have done exhaustive searches on Google to no avail. I hope someone here can help me. Quote Link to comment https://forums.phpfreaks.com/topic/161976-data-corruption-using-odbc_connect-in-php-when-over-32767-rcds-returned/ Share on other sites More sharing options...
PFMaBiSmAd Posted June 12, 2009 Share Posted June 12, 2009 32767 is in fact the maximum for a signed 16 bit integer, so it is likely you are up against a bug, but what is the code for displayRowAssoc()? What tool are you using to examine the actual data, which I assume is correct in the database? Quote Link to comment https://forums.phpfreaks.com/topic/161976-data-corruption-using-odbc_connect-in-php-when-over-32767-rcds-returned/#findComment-854660 Share on other sites More sharing options...
PFMaBiSmAd Posted June 13, 2009 Share Posted June 13, 2009 Or more directly, what does a print_r() or var_dump() of $row show? You need to pin down at what point the data is correct and at what point it is not. Is the php code receiving the correct data in $row or is the data wrong in the displayed output from displayRowAssoc()? Quote Link to comment https://forums.phpfreaks.com/topic/161976-data-corruption-using-odbc_connect-in-php-when-over-32767-rcds-returned/#findComment-854954 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.