|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2001-08-27 07:38 UTC] sniper@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 05 11:00:02 2025 UTC |
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...