Jump to content


Photo

Changing Array Keying


  • Please log in to reply
2 replies to this topic

#1 AV1611

AV1611
  • Members
  • PipPipPip
  • Advanced Member
  • 997 posts

Posted 27 June 2006 - 03:52 PM

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



#2 Orio

Orio
  • Staff Alumni
  • Advanced Member
  • 2,491 posts

Posted 27 June 2006 - 05:33 PM

function number_array($arr){
$i=0;
foreach ($arr as $value){
$arr2[$i]=$value;
$i++;
};
return $arr2;
};


Orio.
Think you're smarty?

(Gone until 20 to November)

#3 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 27 June 2006 - 06:03 PM

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.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users