Added an array into array

Hi all,

Someone know how to added an array into array?


[php]for ($i=0;<$i<count;$i++)


//some sql command and codes… got the array valid like $carriername,$carrierid…etc


now i wanted to rebuild an new array($totalrecord[]) and store the $record[$i]

I expected the output like this

$totalrecord[]= ($record[0],$record[1],$record[2]…record[$i])

Someone can help ? Thanks

Brgds/Brandon Chau

you are rewriting $record on each loop

if you change to this it will add the array to a new key in the record-array
[php]$record[] = array(“carriername”=…[/php]

so you will get

$record = [ 0 => [ carriername = somevalue carrierid = somevalue ... ], 1 => [ carriername = somevalue carrierid = somevalue ... ], ... ]

Hi JimL,

woo , oh yes , thank you so much ^^"

Thanks :smiley:

Brgds/Brandon Chau

Sponsor our Newsletter | Privacy Policy | Terms of Service