...

View Full Version : search field



eric float
12-07-2008, 08:10 AM
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

194673
12-07-2008, 08:24 AM
I think you need to do two things:
1. post your code
2. be more clear

masterofollies
12-07-2008, 02:31 PM
I agree with 194673

eric float
12-07-2008, 10:00 PM
$where_sql = ' WHERE A.enabled='. SYS_ENABLED .' AND A.posted_date<='. CURRENT_TIME;
if ( !empty($this->filter['keyword']) ){
if ( SEARCH_TYPE == 1 ){
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 . . . . . . . . . . . . . . .

eric float
12-08-2008, 10:07 PM
any idea ??



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum