php - How to get the result separated by ,? -


$getmusiclist =explode(',', $event[0]['even_music']);             print_r($getmusiclist); 

this line gives

    array     (     [0] => 3     [1] => 12     [2] => 5     )        $exegetmusic1 = array();         foreach ($getmusiclist $kk => $musiclist) {               $getmusic = "select event_music_nam et_mc                   eventmusic_id='".$musiclist."'";              $exegetmusic = execute_query($getmusic, false, "select");              $exegetmusic1[] = $exegetmusic;            }         print_r($exegetmusic1); 

this line gives

array (     [0] => array         (             [event_music_nam] => alternative         )      [1] => array         (             [event_music_nam] => classics         )      [2] => array         (             [event_music_nam] => country/folk         )  ) 

but want final ans should

alternative,classics,country/folk 

plz help. thanks

when there 1 item in sub array why creating sub array @ all, manage them in single dimension array. follow below

replace last line of foreach $exegetmusic1[] = $exegetmusic;

with line below

$exegetmusic1[] = $exegetmusic['event_music_nam']; 

and replace print_r($exegetmusic1); line

echo implode(',',$exegetmusic1); 

Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -