HI Following is the code , i am trying to print the array which contain values of drop down menu and then 2nd foreach loop is trying to selected the field. The output is the way i want , mean it print the all menu item, and the selected one,
foreach($results as $data):
$st = '';
foreach($SelectedActor as $SelectedActor):
if($SelectedActor['id']==$data['id']){$st='selected="selected"';}
endforeach;
$dd .="<option ".$st." value=".$data['id']."> ".$data['artist_name']." </option>";
endforeach;
but the page also show this error
A PHP Error was encountered
Severity: Warning
Message: Illegal string offset 'id'
Filename: controllers/replik.php
Line Number: 328
Vardump for these two array are
array (size=2)
0 =>
array (size=2)
'id' => string '1' (length=1)
'artist_name' => string ' oyuncu' (length=19)
1 =>
array (size=2)
'id' => string '4' (length=1)
'artist_name' => string 'hep brabir' (length=10)
array (size=2)
0 =>
array (size=2)
'id' => string '1' (length=1)
'artist_name' => string 'oyuncu' (length=19)
1 =>
array (size=2)
'id' => string '4' (length=1)
'artist_name' => string 'hep brabir' (length=10)
Can any one help me to get the reason of this error.
var_dump($SelectedActor, $data)- one of these is not an array.