ID: 24740
User updated by: rarteaga at icaro dot com dot ec
Reported By: rarteaga at icaro dot com dot ec
Status: Open
Bug Type: OCI8 related
Operating System: Linux RH9 and RH7.3
PHP Version: 4.3.2
New Comment:

I'm sorry I made a mistake on the line

OCIDefineByName($p,"ENAME",$job);

The correct value must be JOB, it will be like this:

OCIDefineByName($p,"JOB",$job);

Still doesn't work..

Regards


Previous Comments:
------------------------------------------------------------------------

[2003-07-21 11:54:58] rarteaga at icaro dot com dot ec

Description:
------------
Hi, I've installed Linux RH 9.0 and Oracle 9i, I'm trying to access the
database from a php script, I make de connection and make a simple
select like this:

"SELECT EMPNO from EMP"

And I get the information just fine with the oci functions (OCILogon,
OCIP, OCIExecute, etc...). Now I get a segmentation fault when I
try to retrieve information of fields that are string or characteres,
something like this:

"SELECT JOB from EMP"

The script crashes and dies saying "segmentation fault"

I'm connecting to the database as user "SCOTT" and getting information
from table EMP.

I can connect from an aplication I've developed in VB60 from a remote
aplication server I have... but PHP is crashing...

Best Regards

Reproduce code:
---------------
#!/usr/bin/php -q
<?php
putenv("ORACLE_HOME=/opt/oracle/product/9.2.0");
$username = "SCOTT";
$passwd = "TIGER";
$db="icaro";
$conn = OCILogon($username,$passwd,$db);
if (!$conn) {
echo "Connection failed";
echo "Error Message: [" . OCIError($conn) . "]";
exit;
}
else {
echo "Connected!"."\n";
$p = OCIP($conn,"select JOB from EMP");
OCIDefineByName($p,"ENAME",$job);
OCIExecute($p,OCI_DEFAULT);
echo "\nRecuperacion de datos\n";
while (OCIFetchinto ($p, $row, OCI_ASSOC)) {
echo $job;
echo "\n";
}
}
?>

Expected result:
----------------
I expect to see de job titles..

Actual result:
--------------
[rootoralinux htdocs]# ./oracle.php
Connected!
Segmentation fault


------------------------------------------------------------------------


--
Edit this bug report at [url]http://bugs.php.net/?id=24740&edit=1[/url]