I am accessing DB2 information on an IBM i (AS400) with PHP.
With this code:
$query = "SELECT * FROM QS36F.MYTABLE WHERE MYFIELD=120006";
$result = db2_prepare($conn, $query);
db2_execute($result);
$i=0;
while($row = db2_fetch_assoc($result) or die(db2_stmt_errormsg())){
$i++;
print "Row " . $i . " successful<br />";
}
I get:
SELECT * FROM QS36F.MYTABLE WHERE MYFIELD=120006
Row 1 successful
Row 2 successful
Row 3 successful
Row 4 successful
Data conversion or data mapping error. SQLCODE=-802
There should be more than 4 results. Why might this error be occurring?
More details:
- This same error seems to happen on any value I search for in MYFIELD although it may be after a different number of successful results
- MYFIELD is NUMERIC(7,0)
- I can search other fields in the table(including numeric ones) and it works fine.