Creating Search Code ?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Shalini Bhalla
    New Member
    • Dec 2007
    • 190

    Creating Search Code ?

    Hi ,

    i am developing an application based on real estate agents.I need to put n no. of search criteria in that.
    I want to know the best coding for creating search criteria with minimum efforts. I have some 10 to 15 fields on which i need to create search. do i have to write all queries or there is any other professional method which can help me in writing a single or less queries with different search criteria.
  • perhapscwk
    New Member
    • Sep 2007
    • 123

    #2
    suggestion as below.

    each criteria need one more row as below

    Code:
    	
    $sql = "select * from table where id=xxx";
    
    if ($criteria1){
    	$sql  .= " and criteria1 like \"%$criteria1%\"";
    	}
    .
    .
    .
    
    if ($criteria15){
    	$sql  .= " and criteria15 like \"%$criteria15%\"";
    	}

    Comment

    • Shalini Bhalla
      New Member
      • Dec 2007
      • 190

      #3
      till now i am doing this only , but i need to take care of n no. of criteria , anything in shortcut .

      Comment

      • perhapscwk
        New Member
        • Sep 2007
        • 123

        #4
        use loop...

        table field store as array
        variable store as array.

        Comment

        Working...