Page 1 of 1

one final question and i will finally get this working

Posted: Thu Nov 03, 2005 3:34 pm
by vincenzobar
I need to take an array and chop it into 2 different arrays according to the Key

for example

Code: Select all

if(is_array($name)){
								foreach($name as $k4=>$attributes){
									$hold[] = strtolower($k4);
									$row = array_unique($hold);
									
									$content[] = $attributes;
$name is the main array
$hold holds the key names and the it parses to unique because all i need is 1 occurance of the key to use the implode to create a variable to use in MySQ Insert statements.

carrierdescription and carrierlogo

now $content holds the values of the keys and i need a way to parse them into seperate arrays to implode into MySQL

What do i use to cut an array up but "carrierdescription' and 'carrierlogo'?

Posted: Thu Nov 03, 2005 3:37 pm
by vincenzobar
my outp put looks like this

Code: Select all

('carrierdescription', 'carrierlogo')

and

('ALLTEL Wireless', 'images/carriers/AllTel_logo.gif', 'Cellular One', 'images/carriers/Cellularone-Lsf.gif', 'Cingular Wireless', 'images/carriers/cingularlogo.gif', 'Liberty Wireless', 'images/carriers/liberty_logo.gif', 'Nextel', 'images/carriers/nextel_logo.gif', 'Sprint PCS', 'images/carriers/sprint_logo.gif', 'StarBox', 'images/carriers/Motient_logo.gif', 'T-Mobile', 'images/carriers/tmobile_logo.gif', 'U.S. Cellular', 'images/carriers/uscellular_l.gif', 'Verizon Wireless', 'images/carriers/verizonLogo.gif')

Posted: Thu Nov 03, 2005 5:37 pm
by Luke
This what you're looking for?

Code: Select all

foreach($array as $key => $val){
    if($key == "first"){
        $newarrayone[] = $val;
    }
    elseif($key == "second"){
        $newarraytwo[] = $val;
    }
    else{
        $junk[] = $val;
    }
}
Your question is confusing.