php - Make an array of two -


i'd make array tells site's pages show in php.
in $sor["site_id"] i've got 2 or 4 chars-lenght strings. example: 23, 42, 13, 1
in other array (called $pages_show) want give site_ids other id.

$parancs="select * pages order id"; $eredmeny=mysql_query($parancs) or die("hibás sql:".$parancs); while($sor=mysql_fetch_array($eredmeny))  { $pages[]=array( "id"=>$sor["id"], "name"=>$sor["name"], "title"=>$sor["title"], "description"=>$sor["description"], "keywords"=>$sor["keywords"] ); // makes pages array information page.  $shower = explode(", ",$sor["site_id"]); // explode site_id $pages_show[]=array( "id"=>$sor["id"], "where"=>$shower //to 'where' want put explode's elements one-by-one, result down ); 

this script gives me following result:

array (3) 0 => array (2)   id => "29"   => array (2)     0 => "17"     1 => "16" 1 => array (2)   id => "30"   => array (1)     0 => "17" 2 => array (2)   id => "31"   => array (1)     0 => "17" 

but in case i'd this:

array (4) 0 => array (2)   id => "29"   => "17" 1 => array (2)   id => "29"   => "16" 2 => array (2)   id => "30"   => "17" 3 => array (2)   id => "31"   => "17" 

thanks help.

you have loop on $shower array:

$shower = explode(", ",$sor["site_id"]); // explode site_id  foreach($shower $show) {     $pages_show[]=array("id"=>$sor["id"],"where"=>$show); } 

Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -