Bookmarks

Yahoo Gmail Google Facebook Delicious Twitter Reddit Stumpleupon Myspace Digg

Search queries

192.168.1.41:8000, Www.xxxcon., %s wwwxxxcon, %s wwwxxxcon, www.xxxcon, xxxxdup, bitlord outgoing port settings, ckowwwxxx, 192.168.1.41:8000/nor-482.html, php.ini "Unable to initialize module"

Links

XODOX
Impressum

#1: Probleme with output of function oci_fetch_all

Posted on 2011-09-14 18:05:58 by andre.lagadec

--------------000404010406010404070800
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Hi,

I use PHP with Oracle and I have this code:
$req="select identifiant as \"0\", name as \"1\" from TAB_USER where
identifiant='abcd' and mot_passe='password'";
$conn = oci_connect('foo', 'bar', 'BASE1');
if (!$conn) {
$e = oci_error();
trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
}
$stid = oci_parse($conn, $req);
oci_execute($stid);
$nrows = oci_fetch_all($stid, $tab2);
echo "<BR>$nrows rows fetched<br>\n";
echo "<BR>tab2[0][0]=".$tab2[0][0];

It works fine in PHP-4.3.10 and give this result
1 rows fetched
tab2[0][0]=abcd

But it doesn't work fine in PHP-5.2.13, because it give this :
1 rows fetched
tab2[0][0]=

If I add this code and run it
echo "<BR>print_r tab2 =<BR>";
print_r($tab2);
var_dump($tab2);

I get in PHP-4.3.10
print_r tab2 =
Array ( [0] => Array ( [0] => abcd ) [1] => Array ( [0] => toto ) )
array(2) { [0]=> array(1) { [0]=> string(4) "abcd" } [1]=> array(1) {
[0]=> string(4) "toto" } }

And in PHP-5.2.13
print_r tab2 =
Array ( [0] => Array ( [0] => abcd ) [1] => Array ( [0] => toto ) )*
array*

'0'=>
*array*
0=> string 'abcd' /(length=4)/
'1'=>
*array*
0=> string 'toto' /(length=4)/

Why there is 'O' in PHP-5.2.13 and not 0 like PHP-4.3.10 ?

Thanks for any help.


--------------000404010406010404070800--

Report this message