Web Analytics Made Easy -
StatCounter Can someone please, please help me with this? - CodingForum

Announcement

Collapse
No announcement yet.

Can someone please, please help me with this?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Can someone please, please help me with this?

    Greetings experts,

    I have the following code:

    PHP Code:
    $fields = array(
        
    'projectTitle' => array('field' => 'b.BidTitle''searchType' => 'like'),
        
    'bidType' => array('field' => 'b.BidType''searchType' => 'equal'),
        
    'bidStatus' => array('field' => 'b.BidStatus''searchType' => 'equal'),
        
    'department' => array('field' => 'b.AliasID''searchType' => 'equal'),
        
    'bidId' => array('field' => 'b.BidID''searchType' => 'like'),
        
    'txtFromDate' => array('field' => 'b.BidDate''searchType' => 'gte'),
        
    'txtToDate' => array('field' => 'b.BidDate''searchType' => 'lte'),
        
    'txtFromDueDate' => array('field' => 'b.DueDate''searchType' => 'gte'),
        
    'txtToDueDate' => array('field' => 'b.DueDate''searchType' => 'lte'),
        
    'bidDate' => array('field' => 'b.BidDate''searchType' => 'equal'),
        
    'dueDate' => array('field' => 'b.DueDate''searchType' => 'equal'),
        
    'ddlCategory' => array('field' => 'b.CategoryID''searchType' => 'equal')
    );

    $where = array();
    $searchType "";
    foreach(
    $fields as $fieldPost => $field) {
        if(isset(
    $_GET[$fieldPost]) && strlen($_GET[$fieldPost]) > 0) {
            if(
    $field['searchType'] == 'like') {
                
    $where[] = "".$field['field']." LIKE '%" ms_escape_string($_GET[$fieldPost]) . "%'";
            } elseif (
    $field['searchType'] == 'gte') {
                
    $where[] = "".$field['field']." >= '" ms_escape_string($_GET[$fieldPost]) . "'";
            }
              elseif (
    $field['searchType'] == 'lte') {
                
    $where[] = "".$field['field']." <= '" ms_escape_string($_GET[$fieldPost]) . "'";
            }
              else {
                
    $where[] = "".$field['field']." = '" ms_escape_string($_GET[$fieldPost]) . "'";
            }
            
    $searchType .= (empty($searchType) ? "" "&") . $fieldPost "=" $_GET[$fieldPost];
           
    // echo $searchType;
        
    }
    }




       
    $tsql "Select COUNT(*) As totalRecords
              FROM bids b inner join DeptALIAS da on b.AliasID = da.AliasID inner join Dept d on da.DeptCode =d.DeptCode inner join status s on b.BidStatus=s.StatusId " 
    . ( count($where) > " WHERE " implode(' AND '$where) : " " );
    //echo $tsql; 
    As you can see from the code, the query runs and displays results based on what parameter or parameters are passed to it.

    It works fine.

    The issue now is that management has decided that one of the values from Bstatus should not be displayed.

    That value is called CLOSED.

    Given the dynamic nature of the code, I am having problem modifying it.

    Can someone please help?

    Thanks a lot in advance

  • #2
    Read the answer over at phpfreaks.

    Comment

    Working...
    X