Dear All,
Language: PHP v4.05
OS: RedHat Linux 7.1
WebServer: Apache 1.3.20 w/mod_php
DB2: db2connect-7.1
DB Server: IBM AS/400 DB2
Connect to db2/as400 under the console of DB2 Connect works!
However, connect to db2/as400 via PHP fail sometime with the following
error, what's the problems?
Warning: SQL error: , SQL state in SQLConnect in test.php on line 5
- test.php --------------------------------------------------------
<?php
putenv("LD_LIBRARY_PATH=/home/db2inst1/sqllib/lib");
putenv("DB2INSTANCE=db2inst1");
$sql = "select * from PATRICK.TEMP";
$cnx = odbc_connect("linux", "LINUX", "LINUX");
$cur = odbc_exec ($cnx, $sql);
$Fields = odbc_num_fields($cur);
print "<table border='1' width='100%'><tr>";
// Build Column Headers
for ($i=1; $i <= $Fields; $i++){
printf("<th bgcolor='silver'>%s</th>", odbc_field_name( $cur,$i));
}
// Table Body
$Outer=0;
while( odbc_fetch_row( $cur )){
$Outer++;
print "<tr>";
for($i=1; $i <= $Fields; $i++){
printf("<td>%s</td>", odbc_result( $cur, $i ));
}
print "</tr>";
}
print "</table>";
print "<b> Your request returned $Outer rows!</b>";
// odbc_close( $cnx);
?>
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]