- To: php-db@xxxxxxxxxxxxx
- Subject: Probleme with output of function oci_fetch_all
- From: André LAGADEC <andre.lagadec@xxxxxxxxxxxxxxxxx>
- Date: Wed, 14 Sep 2011 18:05:58 +0200
- User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; fr; rv:1.9.2.22) Gecko/20110902 Thunderbird/3.1.14
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.
[PHP Home]
[PHP Users]
[Postgresql Discussion]
[Kernel Newbies]
[Plagiarism Notes]
[Postgresql]
[Yosemite News]