arrays - PHP Lost value of foreach after if -
i lost value in foreach after if
foreach ($etc_uloziste $id => $etc_id) { foreach ($etc_id $id2 => $etc_id2) { if($rodic1==$id) { if( ! in_array( $etc_id2, $etc_mn) ) { //check if season displayed $sql.= ",\n"." ".$etc_id2."_id"." int"; $etc_mn[] = $etc_id2; //store season in array } } } }
before if have value like:
[book] => array ( [0] => library [1] => room )
but after if have
[book] => array ( [0] => library )
the $etc_id2 library or room , $id book
i lost value in 2. echo
foreach ($result2 $rodic1 => $rodic_hodnot1) { foreach ($etc_uloziste $id => $etc_id) { foreach ($etc_id $id2 => $etc_id2) { //echo $etc_id2."\n"; if($rodic1 ==$id) { //echo $etc_id2."\n"; } } } }
Comments
Post a Comment