Sunday, 29 September 2013

php foreach shows only results for an x result in one of my rows

php foreach shows only results for an x result in one of my rows

There is a forech search, I want to get the results only where $postType<2
. How can I amend my code?
<?php
if ($resultSearch){
foreach ( $resultSearch as $row ){
$idPost=$row['idPost'];
$postType=$row['type'];
$postTypeName=getTypeName($postType);
$postTitle=$row['title'];
$category=$row['category'];//real category name
$fcategory=$row['fcategory'];//frienfly name category
$idCategoryParent=$row['idCategoryParent'];
$fCategoryParent=$row['parent'];
$postImage=$row['image'];
$insertDate=setDate($row['insertDate']);
if ($row["hasImages"]==1){
$postImage=getPostImages($idPost,$insertDate,true,true);
}
else $postImage=getPostImages(true,true,true,true);//there's no image
$postUrl=itemURL($idPost,$fcategory,$postTypeName,$postTitle,$fCategoryParent);?>

No comments:

Post a Comment