php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #27194 select doesn't work with where clause
Submitted: 2004-02-09 12:14 UTC Modified: 2004-02-09 17:01 UTC
From: alexandre dot fontes at uol dot com dot br Assigned:
Status: Not a bug Package: OCI8 related
PHP Version: 4.3.4 OS: Red Hat 9.0
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: alexandre dot fontes at uol dot com dot br
New email:
PHP Version: OS:

 

 [2004-02-09 12:14 UTC] alexandre dot fontes at uol dot com dot br
Description:
------------
The following program runs perfectly.
But if we put an WHERE clause on SELECT command, the program fails (Server not found).
The same SELECT command, with the same WHERE clause runs ok on SQL*Plus.


Reproduce code:
---------------
<?php

$db_conn = ocilogon( "USER", "PASSWORD", "DATABASE" );
$cmdstr = "select name from people";
$parsed = ociparse($db_conn, $cmdstr);
ociexecute($parsed);
$nrows = ocifetchstatement($parsed, $results);

echo "<html><head><title>Oracle PHP Test</title></head><body>";
echo "<center><h2>Oracle PHP Test</h2><br>";
echo "<table border=1 cellspacing='0' width='50%'>\n\<tr>\n";
echo "<td><b>Name</b></td>\n<td><b>Salary</b></td>\n</tr>\n";

for ($i = 0; $i < $nrows; $i++ )
{
    echo "<tr>\n";
    echo "<td>" . $results["NAME"][$i] . "</td>";
    echo "</tr>\n";
}

echo "<tr><td colspan='2'> Number of Rows: $nrows</td></tr></table>";
echo "<br><em>If you see data, then it works!</em><br></center></body></html>\n";

?>



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-02-09 12:15 UTC] sniper@php.net
Please provide the NON-working version of the script..

 [2004-02-09 12:46 UTC] alexandre dot fontes at uol dot com dot br
The NON-working version of the script:

<?php

$db_conn = ocilogon( "USER", "PASSWORD", "DATABASE" );
$cmdstr = "select name from people where code=100";
$parsed = ociparse($db_conn, $cmdstr);
ociexecute($parsed);
$nrows = ocifetchstatement($parsed, $results);

echo "<html><head><title>Oracle PHP Test</title></head><body>";
echo "<center><h2>Oracle PHP Test</h2><br>";
echo "<table border=1 cellspacing='0' width='50%'>\n\<tr>\n";
echo "<td><b>Name</b></td>\n<td><b>Salary</b></td>\n</tr>\n";

for ($i = 0; $i < $nrows; $i++ )
{
    echo "<tr>\n";
    echo "<td>" . $results["NAME"][$i] . "</td>";
    echo "</tr>\n";
}

echo "<tr><td colspan='2'> Number of Rows: $nrows</td></tr></table>";
echo "<br><em>If you see data, then it
works!</em><br></center></body></html>\n";

?>
 [2004-02-09 13:39 UTC] tony2001@php.net
Please, provide more info.
I need at least error message.
And it would very good, if you turn on ociinternaldebug() and copy/paste here the output of this function.
 [2004-02-09 14:09 UTC] alexandre dot fontes at uol dot com dot br
PROBLEM SOLVED!!!

Originally, the PHP was compiled with the following command:

./configure \
--prefix=/usr/local/dados/php \
--exec-prefix=/usr/local/dados/php \
--with-apxs2=/usr/local/dados/apache/bin/apxs \
--enable-debug

What's wrong? The --with-oci8 and --with-oracle directives are missing, so with:

./configure \
--prefix=/usr/local/dados/php \
--exec-prefix=/usr/local/dados/php \
--with-apxs2=/usr/local/dados/apache/bin/apxs \
--enable-debug \
--with-oracle=/oracle/ora8i \
--with-oci8=/oracle/ora8i \
--enable-sigchild

It worked!!!
 [2004-02-09 17:01 UTC] tony2001@php.net
you don't need both oracle & oci8 modules.
it's recommended to use oci8, 'cause ora_* extension is obsolete.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Oct 31 23:01:28 2024 UTC