Bug #12966: Problems PHP/INGRES
| From: | thierry dot pinon at fr dot alcove dot com | Date: | Mon, 27 Aug 2001 09:06:47 +0000 |
| Subject: | Bug #12966: Problems PHP/INGRES | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-64378@lists.php.net to get a copy of this message | ||
From: thierry.pinon@fr.alcove.com
Operating system: System HP-UX dev2 B.11.00 A
PHP version: 4.0.5
PHP Bug Type: *Database Functions
Bug description: Problems PHP/INGRES
When a ingres_fetch_array is done without FLAG, the result is not ok.
Constantes II_NUM, II_ASSOC et II_BOTH are not known by PHP.
We must use 1,2,3 in the fetch function to avoid this problem.
Example with this small script :
<?php
print "Without FLAG (Suppose to be II_BOTH by défaut)<br>";
$comm = ingres_connect("dtm", "pmm", "pmm01");
ingres_query("select cplan,vlongarti,vhautarti from p301dimec WHERE
cplan='2247620'", $comm);
$result = ingres_fetch_array($comm);
print var_dump($result);
print "<br>";
ingres_close($comm);
$comm = ingres_connect('nart', 'pmm', 'pmm01');
ingres_query("select crefart,nordart,nvlogart from o101comb WHERE
crefart='0000210'", $comm);
$result = ingres_fetch_array($comm);
print var_dump($result);
print "<br><br>";
print "With FLAG = 1 (II_ASSOC)<br>";
$comm = ingres_connect("dtm", "pmm", "pmm01");
ingres_query("select cplan,vlongarti,vhautarti from p301dimec WHERE
cplan='2247620'", $comm);
$result = ingres_fetch_array(1,$comm);
print var_dump($result);
print "<br>";
ingres_close($comm);
$comm = ingres_connect('nart', 'pmm', 'pmm01');
ingres_query("select crefart,nordart,nvlogart from o101comb WHERE
crefart='0000210'", $comm);
$result = ingres_fetch_array(1,$comm);
print var_dump($result);
print "<br><br>";
print "With FLAG = 2 (II_NUM)<br>";
$comm = ingres_connect("dtm", "pmm", "pmm01");
ingres_query("select cplan,vlongarti,vhautarti from p301dimec WHERE
cplan='2247620'", $comm);
$result = ingres_fetch_array(2,$comm);
print var_dump($result);
print "<br>";
ingres_close($comm);
$comm = ingres_connect('nart', 'pmm', 'pmm01');
ingres_query("select crefart,nordart,nvlogart from o101comb WHERE
crefart='0000210'", $comm);
$result = ingres_fetch_array(2,$comm);
print var_dump($result);
print "<br><br>";
print "With FLAG = 3 (II_BOTH)<br>";
$comm = ingres_connect("dtm", "pmm", "pmm01");
ingres_query("select cplan,vlongarti,vhautarti from p301dimec WHERE
cplan='2247620'", $comm);
$result = ingres_fetch_array(3,$comm);
print var_dump($result);
print "<br>";
ingres_close($comm);
$comm = ingres_connect('nart', 'pmm', 'pmm01');
ingres_query("select crefart,nordart,nvlogart from o101comb WHERE
crefart='0000210'", $comm);
$result = ingres_fetch_array(3,$comm);
print var_dump($result);
print "<br><br>";
?>
Results are :
Without FLAG (Suppose to be II_BOTH by défaut)
array(3) { ["cplan"]=> string(7) "2247620" ["vlongarti"]=>
float(0)
["vhautarti"]=> float(145) }
array(3) { [1]=> string(7) "0000210" [2]=> string(5) "00002" [3]=>
string(1) "1" }
As you can see above, first array is only associative and second is only
numeric.
See the other case :
With FLAG = 1 (II_ASSOC)
array(3) { ["cplan"]=> string(7) "2247620" ["vlongarti"]=>
float(0)
["vhautarti"]=> float(145) }
array(3) { ["crefart"]=> string(7) "0000210" ["nordart"]=>
string(5)
"00002" ["nvlogart"]=> string(1) "1" }
With FLAG = 2 (II_NUM)
array(3) { [1]=> string(7) "2247620" [2]=> float(0) [3]=> float(145) }
array(3) { [1]=> string(7) "0000210" [2]=> string(5) "00002" [3]=>
string(1) "1" }
With FLAG = 3 (II_BOTH)
array(6) { [1]=> string(7) "2247620" ["cplan"]=> string(7)
"2247620"
[2]=>
float(0) ["vlongarti"]=> float(0) [3]=> float(145) ["vhautarti"]=>
float(145) }
array(6) { [1]=> string(7) "0000210" ["crefart"]=> string(7)
"0000210"
[2]=> string(5) "00002" ["nordart"]=> string(5) "00002" [3]=>
string(1)
"1"
["nvlogart"]=> string(1) "1" }
Thanks...
--
Edit bug report at: http://bugs.php.net/?id=12966&edit=1