Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5

Thread: search field

  1. #1
    New Coder
    Join Date
    Dec 2007
    Posts
    59
    Thanks
    0
    Thanked 0 Times in 0 Posts

    search field

    hi ,
    I have any field for search in my website . when import images or table or any tags html in article save all data in db ( mysql ) . now search with html tag in search field show layout my page !!!!
    example : search font = show <font . . . . . . . . in layout page . how to fix this problem ?? thank regards

  • #2
    Regular Coder
    Join Date
    Dec 2006
    Posts
    166
    Thanks
    9
    Thanked 4 Times in 4 Posts
    I think you need to do two things:
    1. post your code
    2. be more clear

  • #3
    Senior Coder
    Join Date
    May 2005
    Posts
    2,137
    Thanks
    96
    Thanked 72 Times in 72 Posts
    I agree with 194673

  • #4
    New Coder
    Join Date
    Dec 2007
    Posts
    59
    Thanks
    0
    Thanked 0 Times in 0 Posts
    PHP Code:
    $where_sql    ' WHERE A.enabled='SYS_ENABLED .' AND A.posted_date<='CURRENT_TIME;
            if ( !empty(
    $this->filter['keyword']) ){
                if ( 
    SEARCH_TYPE == ){
                    if ( 
    $this->filter['match'] == 'words' ){$keyword    str_replace(' ''*'$this->filter['keyword']);
                    }
                    else{
    $keyword    $this->filter['keyword'];
                    }
    if ( 
    $this->filter['in'] == 'title' ){ //Search in Title only
                        
    $where_sql    .= " AND (MATCH (A.title) AGAINST ('"$keyword ."'))";
                    }
                    else if ( 
    $this->filter['in'] == 'content' ){ //Search in Content only
                        
    $where_sql    ", "$DB->prefix ."article_page_content AS P "$where_sql ." AND A.article_id=P.article_id AND (MATCH (P.content_detail) AGAINST ('"$keyword ."'))";
                        
    $group_by    " GROUP BY A.article_id";
                    }
                    else{ 
    //Search in all fields
                        
    $where_sql    ", "$DB->prefix ."article_page_content AS P "$where_sql ." AND A.article_id=P.article_id AND ((MATCH (A.title, A.content_desc) AGAINST ('"$keyword ."')) OR (MATCH (P.author, P.content_detail) AGAINST ('"$keyword ."')))";
                        
    $group_by    " GROUP BY A.article_id";
                    }
                }
                else{
                    if ( 
    $this->filter['match'] == 'words' ){
                        
    //Search for words
                        
    $keyword    str_replace(' ''%'$this->filter['keyword']);
                    }
                    else{
                        
    //Search for exact phrase
                        
    $keyword    $this->filter['keyword'];
                    }
                    
    $keyword    str_replace('*''%'$keyword);

                    
    //Normal search
                    
    if ( $this->filter['in'] == 'title' ){ //Search in Title only
                        
    $where_sql    .= " AND (A.title LIKE '%"$keyword ."%')";
                    }
                    else if ( 
    $this->filter['in'] == 'content' ){ //Search in Content only
                        
    $where_sql    ", "$DB->prefix ."article_page_content AS P "$where_sql ." AND A.article_id=P.article_id AND (P.content_detail LIKE '%"$keyword ."%')";
                        
    $group_by    " GROUP BY A.article_id";
                    }
                    else{ 
    //Search in all fields
                        
    $where_sql    ", "$DB->prefix ."article_page_content AS P "$where_sql ." AND A.article_id=P.article_id AND (A.title LIKE '%"$keyword ."%' OR A.content_desc LIKE '%"$keyword ."%' OR P.author LIKE '%"$keyword ."%' OR P.content_detail LIKE '%"$keyword ."%')";
                        
    $group_by    " GROUP BY A.article_id";
                    }
                }
            } 


    and . . . . . . . . . . . . . . . 

  • #5
    New Coder
    Join Date
    Dec 2007
    Posts
    59
    Thanks
    0
    Thanked 0 Times in 0 Posts
    any idea ??


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •