#27194 [Opn->Fbk]: select doesn't work with where clause

From: Date: Mon, 09 Feb 2004 18:39:22 +0000
Subject: #27194 [Opn->Fbk]: select doesn't work with where clause
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-54634@lists.php.net to get a copy of this message
 ID:               27194
 Updated by:       tony2001@php.net
 Reported By:      alexandre dot fontes at uol dot com dot br
-Status:           Open
+Status:           Feedback
 Bug Type:         OCI8 related
 Operating System: Red Hat 9.0
 PHP Version:      4.3.4
 New Comment:

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.


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

[2004-02-09 12:46:54] 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 12:15:47] sniper@php.net

Please provide the NON-working version of the script..


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

[2004-02-09 12:14:00] 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";

?>




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


-- 
Edit this bug report at http://bugs.php.net/?id=27194&edit=1


Thread (6 messages)

« previous php.bugs (#54634) next »