From:             [EMAIL PROTECTED]
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


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to