https://www.icyphoenix.com/viewtopic.php?f=26&t=1296&p=10599#p10599
-----------------------------------
Artie
Fri 23 Mar, 2007 01:27

Re: FAP Search Multiple Fields
-----------------------------------
This may get you close to what you're lookin for.

[code linenumbers=false]

#
## ---- [ OPEN ] -------------------------------------------------------------------------------------------
#
includes/page_header.php
#
## ---- [ FIND ] ----------------------------------------------------------------------------------------------
#
'L_DESCRIPTION' => $lang['Description'],
#
## ---- [ AFTER ADD ] ------------
#
'L_TITLE_DESCRIPTION' => $lang['Title_Description'],
	
#
## ---- [ OPEN ] ------------------------------------------------------------------------------------------
#
language/lang_english/lang_main.php
#
## ---- [ FIND ] ------------
#
$lang['Description'] = 'Description';
#
## ---- [ AFTER ADD ] -----------------------------------------------------------------------------------
#
$lang['Title_Description'] = 'Title & Description';

#
## ---- [ OPEN ] ------------
#
album_search.php
#
## ---- [ FIND ] -------------------------------------------------------------------------------------------
#
if ($m == 'user')
	{
		$where = 'p.pic_username';
	}
	elseif ($m == 'name')
	{
		$where = 'p.pic_title';
	}
	elseif ($m == 'desc')
	{
		$where = 'p.pic_desc';
	}
	else
	{
		message_die(GENERAL_ERROR, 'Bad request');
	}
#
## ---- [ REPLACE WITH ] ----------------------------------------------------------------------------------------
#
		if ($m == 'user')
	{
  	$where =	"AND p.pic_username LIKE '%" . $s . "%'";
	}
	elseif ($m == 'name')
	{
	   $where =	"AND p.pic_title LIKE '%" . $s . "%'";
	}
	elseif ($m == 'desc')
	{
	   $where =	"AND p.pic_desc LIKE '%" . $s . "%'";
	}
  elseif ($m == 'title_desc')
	{
		$where = "AND (p.pic_desc LIKE '%" . $s . "%' OR p.pic_title LIKE '%" . $s . "%')";
	}
	else
	{
		message_die(GENERAL_ERROR, 'Bad request');
	}	
#
## ---- [ FIND ] -------------------------------------------------------------------------------------------------------------
#
$count_sql = "SELECT COUNT(pic_id) AS count
								FROM " . ALBUM_TABLE . ' AS p,' . ALBUM_CAT_TABLE . " AS c
								WHERE p.pic_approval = 1
								AND " . $where .  " LIKE '%" . $s . "%'
								" . $search_pg . "
								AND p.pic_cat_id = c.cat_id";
#
## ---- [ REPLACE WITH ] ---------------------------------------------------------------------------------------------------
#
$count_sql = "SELECT COUNT(pic_id) AS count
								FROM " . ALBUM_TABLE . ' AS p,' . ALBUM_CAT_TABLE . " AS c
								WHERE p.pic_approval = 1
								" . $where .  $search_pg . "
								AND p.pic_cat_id = c.cat_id";                
#
## ---- [ FIND ] ------------------------------------------------------------------------------------------------------------------
#
$sql = "SELECT p.pic_id, p.pic_title, p.pic_desc, p.pic_user_id, p.pic_username, p.pic_time, p.pic_cat_id, p.pic_approval, c.cat_id, c.cat_title, c.cat_user_id
			FROM " . ALBUM_TABLE . ' AS p,' . ALBUM_CAT_TABLE . " AS c
			WHERE p.pic_approval = 1
				AND " . $where .  " LIKE '%" . $s . "%'
				AND p.pic_cat_id = c.cat_id
				" . $search_pg . "
			ORDER BY p.pic_time DESC LIMIT ".$limit_sql."";
#
## ---- [ REPLACE WITH ] ---------------------------------------------------------------------------------------------------------------
#
$sql = "SELECT p.pic_id, p.pic_title, p.pic_desc, p.pic_user_id, p.pic_username, p.pic_time, p.pic_cat_id, p.pic_approval, c.cat_id, c.cat_title, c.cat_user_id
			FROM " . ALBUM_TABLE . ' AS p,' . ALBUM_CAT_TABLE . " AS c
			WHERE p.pic_approval = 1
				" . $where .  "
				AND p.pic_cat_id = c.cat_id
				" . $search_pg . "
			ORDER BY p.pic_time DESC LIMIT ".$limit_sql."";
      
#
## ---- [ OPEN ] ------------
# (each of these 8 template files)
templates/subSilver/album_cat_body.tpl
templates/subSilver/album_comment_body.tpl
templates/subSilver/album_index_body.tpl
templates/subSilver/album_memberlist_body.tpl
templates/subSilver/album_personal_body.tpl
templates/subSilver/album_personal_index_body.tpl
templates/subSilver/album_search_body.tpl
templates/subSilver/album_showpage_body.tpl
#
## ---- [ FIND] ------------
#
	<option value="desc">{L_DESCRIPTION}</option>
#
## ---- [ AFTER ADD ] -----------------------------------------------------------------------
#
	<option value="title_desc">{L_TITLE_DESCRIPTION}</option>	
#
## ---- [ SAVE FILES ] ------------------------------------------------------------------------
#	Eom


[/code]


