application/models/mobile_api/Common_model.php
/* Count Get the comments of shortlisted property with perticular roomType*/
Count Get the comments of shortlisted property with perticular roomType
Count Get the comments of shortlisted property with perticular roomType
public function count_shortlisted_property_comments($post_data){
        $searchId = $post_data['searchId'];
        $shortlistedId = $post_data['shortlistedId'];
        $roomType = $post_data['roomType'];
		$roomType = $roomType;
        $loginUserId = $post_data['loginUserId'];    
        if($roomType == 'ALL'){
            $roomType = '';			
        } else{
            $roomType = 'AND c.roomType ="'.$roomType.'"';
        }   
        $sql = "SELECT c.*,cr.userId as readUserId,cr.commentId as readCommentId,cr.shortlistedId as readShortlistedId,cr.roomType as readRoomType,u.firstName,u.lastName FROM comments c 
            LEFT JOIN commentsread cr ON cr.shortlistedId = c.shortlistedId AND cr.userId = $loginUserId AND c.commentId = cr.commentId
            LEFT JOIN users u ON u.userId = c.userId
            WHERE c.shortlistedId = $shortlistedId AND c.searchId =$searchId $roomType AND c.deleteFlag !=1 ORDER BY c.createdAt DESC";
        $record = $this->db->query($sql);
        if($record->num_rows()>0){
            return $record->num_rows();
        }
    }
public function count_shortlisted_property_comments ( $ post_data ) { $ searchId = $ post_data [ 'searchId' ] ; $ shortlistedId = $ post_data [ 'shortlistedId' ] ; $ roomType = $ post_data [ 'roomType' ] ; $ roomType = $ roomType ; $ loginUserId = $ post_data [ 'loginUserId' ] ; if ( $ roomType == 'ALL' ) { $ roomType = '' ; } else { $ roomType = 'AND c.roomType ="' . $ roomType . '"' ; } $ sql = " SELECT c.*,cr.userId as readUserId,cr.commentId as readCommentId,cr.shortlistedId as readShortlistedId,cr.roomType as readRoomType,u.firstName,u.lastName FROM comments c 
            LEFT JOIN commentsread cr ON cr.shortlistedId = c.shortlistedId AND cr.userId =  $ loginUserId  AND c.commentId = cr.commentId
            LEFT JOIN users u ON u.userId = c.userId

            WHERE c.shortlistedId =  $ shortlistedId  AND c.searchId = $ searchId $ roomType  AND c.deleteFlag !=1 ORDER BY c.createdAt DESC " ; $ record = $ this -> db -> query ( $ sql ) ; if ( $ record -> num_rows ( ) > 0 ) { return $ record -> num_rows ( ) ; } }
Count Get the comments of shortlisted property with perticular roomType
Count Get the comments of shortlisted property with perticular roomType
//$roomType = "'".$roomType."'"; //echo $roomType;exit(); // $sql = "SELECT c.* FROM comments c WHERE c.shortlistedId = $shortlistedId AND c.searchId =$searchId AND c.roomType ='".$roomType."' AND c.deleteFlag !=1"; //echo $sql;exit();