have you tried ifx_fieldtypes and matching the enumerations of that result to the enumerations of yr data array? ie is item 3 of fieldtypes[] the key to item 3 of your data[] array?
even if this does work you will have to select * for everything. bah!
the other option is to grab the field names from yr sql, ie:
$sql="select foo, bar, baz from qux";
$fields = substr(6, (strpos($sql, "from")-6); // or something like that... jut off the top of my head
// $fields should equal "foo, bar, baz"
// turn it into the array [0]="bar" [1]="baz" etc
$field_array = explode(",", $fields);
//get your enumerated results array here called $data[]
for($i=0;$<count($data);$i++){
$enum_res[$fields[$i]] = $data[$i];
}
a bit obfusticated to be sure and it does depend on the sql being a select... but i'm sure you can make it more robust!
lastly, consider using the adodb database abstraction library by johnathan lim. it will require some serious rewrites of yr existing code but the payoff is is that you can use any db you want (yes, even foxpro)
-frymaster
Donnie Rivera wrote:
Hey, I am working on converting a shopping cart that uses mysql to Informix db.
My question is on global spectrum of variables. This shopping cart is pretty complex, but they abstracted their mysql calls to a config file. My question is mysql has a mysql_fetch_array, which returns an associative array. However, Informix doesn’t have this functionality yet, but they do use an ifx_fetch_row, which returns an enumerated array. Doesn’t any one have a snippet of code (or lead me in the right direction) that would remove the meta data out of the return, so that it returns an associative array instead of an enumerated array.
thanks for any help...