I am getting and error Invalid argument supplied for foreach() in the code bellow. Can anyone tell me what I am doing wrong here? I am trying to access the sub array values [0] and [1] here. Just to mention that I have no idea now many values will be in the sub array.
I have placed a comment above of the offending line of code (where the error is)
echo "<pre>";
print_r($mySessData);
echo "</pre>";
Array
(
[addtypeid] =>
[isnew] =>
[orderby] =>
[geographicareaid] =>
[catid] => 1
[catid2] =>
[manufacturerid] =>
[modelid] =>
[yearofmanufacturing_from] =>
[yearofmanufacturing_to] =>
[hoursused_from] =>
[hoursused_to] =>
[horsepowers_from] =>
[horsepowers_to] =>
[price_from] =>
[price_to] =>
[colorid] =>
[isdamaged] =>
[categoriesfilters] =>
Array
(
[0] => 67
[1] => 158
)
)
$sessData = array();
$myresult = array();
$val = array();
if (!empty($mySessData)){
foreach ($mySessData as $sessData) {
// the line bellow is the offending line, where the error is thrown
foreach ($sessData as $val) {
$myresult[$val]= $val;
foreach($filters as $f) {
if ($f['filterid'] == $myresult[$val]) {
$strWhere2 .= $myresult[$val] .",";
} // end if
} // end of third foreach
} // end of second foreach
} // end of first foreach
} // end if