|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2007-07-27 15:15 UTC] hbouslama at edison dot ca
Description:
------------
Hi every body,
I'm using PHP 5.2.3=>ODBC System DSN=>DataDirect 4.0=>Network Client for Progress 91.E and finaly Apache2.
All are installed on Win2000 and Progress on Unix
I succeed connecting to the ODBC DSN and I can display filds names
but I can't receive data, the number of rows received is 0
I tried displaying data using other tools like Aqua data studio, RazorSql, Excel and Open Office all is going well. but not with PHP
I tried also to connect to a MySql database using ODBC and it works correctly
In the error log there's no error reported
Thank you for your time and effort
Reproduce code:
---------------
$DBCon = &ADONewConnection(SQL_DRIVER);
$DBCon->PConnect(SQL_HOSTNAME,SQL_USERNAME,SQL_PASSWORD,SQL_DATABASE) or die(' CONNECTION ERROR : '.odbc_errormsg());
if($DBCon)
echo '<br>Connection established successfully';
$sql = 'SELECT CD_CIE, CD_SUCC FROM ACINTEL';
$result = $DBCon->Execute($sql);
if($result){
echo '<br>Resultset is ok'.odbc_errormsg();
echo '<br>Row count = '.$result->RowCount().".<br>";
echo '<br>Field count = '.$result->FieldCount().".<br>";
for ($i=0;$i<$result->FieldCount();$i++){
$objField = $result->FetchField($i);
echo "Field no $i = ". $objField->name."<br>";
}
echo 'Data : <br><pre>';
while ($arr = $result->FetchRow()) {
echo '<br>';
print_r($arr);
}
}
Expected result:
----------------
Connection established successfully
Resultset is ok
Row count = 3.
Field count = 2.
Field no 0 = CD_CIE
Field no 1 = CD_SUCC
Data :
Array(
[0]=>Array(
[CD_CIE]=>Value1
[CD_SUCC]=>Value2
)
[1]=>Array(
[CD_CIE]=>Value3
[CD_SUCC]=>Value4
)
[2]=>Array(
[CD_CIE]=>Value5
[CD_SUCC]=>Value6
)
)
Actual result:
--------------
Connection established successfully
Resultset is ok
Row count = 0.
Field count = 2.
Field no 0 = CD_CIE
Field no 1 = CD_SUCC
Data :
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 03:00:02 2025 UTC |
Hi I didn't find the driver PDO ODBC in adodb/drivers/ I tried : $DBCon = &ADONewConnection('pdo'); $DBCon->PConnect('MyDSN_name', 'MyUser', 'MyPass', 'MyDatabase_Name'); And it generates an Error !