$getMusicList =explode(',', $event[0]['even_music']);
print_r($getMusicList);
this line gives
Array
(
[0] => 3
[1] => 12
[2] => 5
)
$exeGetMusic1 = array();
foreach ($getMusicList as $kk => $musicList) {
$getMusic = "select event_music_nam FROM et_mc
WHERE 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 I want to the final ans should be like this
Alternative,Classics,Country/Folk
plz help.
thanks
When there is only one item in sub array then why are you creating sub array at all, manage them in single dimension array. follow the below
Replace the last line of foreach
$exeGetMusic1[] = $exeGetMusic;with the line below
and replace
print_r($exeGetMusic1);with this line