Probleme with output of function oci_fetch_all

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux