Jump to content

Archived

This topic is now archived and is closed to further replies.

AV1611

Changing Array Keying

Recommended Posts

if I have an array like this:

Array
(
[datshtid] => 000371
[sample] => 000005
[it_date] => 2006-01-12
[insptype] => Final Inspections
[process] => VQ Functional Outputs
[product] => TEK.SS3.UNIT
[descr] => Fit in cradle
[serialno] => S3001015
[failed] => 0
[hi] => 0
[lo] => 0
[units] =>
[actual] => 0
[gonogo] => 1
[passfail] => 0
[step] => 1
[passed] => 1
)

and I want it keyed by numbers ([0] => 000371, etc.) instead,
how can I convert it with PHP.... I am not using MySQL, but ODBC, so I am stuck with what I got I guess

Thanks

Share this post


Link to post
Share on other sites
[code]function number_array($arr){
$i=0;
foreach ($arr as $value){
$arr2[$i]=$value;
$i++;
};
return $arr2;
};[/code]


Orio.

Share this post


Link to post
Share on other sites
Is this a result from an ODBC query? If it is you can use odbc_fetch_rows function, which is the same as mysql_fetch_rows, but works with odbc instead.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.