# Search id must be an integer - What 'am I Missing? HELP!

**URL:** <https://forum.kirupa.com/t/search-id-must-be-an-integer-what-am-i-missing-help/327348>\
**Category:** flash\
**Created:** [February 23, 2012, 1:35pm UTC](https://forum.kirupa.com/t/search-id-must-be-an-integer-what-am-i-missing-help/327348 "2012-02-23T13:35:16Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Scotty13](https://avatars.discourse-cdn.com/v4/letter/s/7bcc69/32.png) [@Scotty13](https://forum.kirupa.com/u/Scotty13)\
**Post date:** [February 23, 2012, 1:35pm UTC](https://forum.kirupa.com/t/search-id-must-be-an-integer-what-am-i-missing-help/327348/1 "2012-02-23T13:35:16Z")

</div>

I’m a newbie… Here’s my php script: search\_rules.php  
(Line 33 - marked below)  
\<?php  
\*/  
function inc\_exc\_str($is\_included)  
{  
return $is\_included ? l10n(‘included’) : l10n(‘excluded’);  
}  
// ±----------------------------------------------------------------------+  
// | initialization |  
// ±----------------------------------------------------------------------+  
define(‘PHPWG\_ROOT\_PATH’,’./’);  
include\_once( PHPWG\_ROOT\_PATH.‘include/common.inc.php’ );  
check\_status(ACCESS\_FREE);  
include\_once( PHPWG\_ROOT\_PATH.‘include/functions\_search.inc.php’ );  
$page[‘body\_id’] = ‘thePopuphelpPage’;  
$title = l10n(‘Piwigo Help’);  
$page[‘page\_banner’] = ‘’;  
$page[‘meta\_robots’]=array(‘noindex’=\>1, ‘nofollow’=\>1);  
include(PHPWG\_ROOT\_PATH.‘include/page\_header.php’);  
$template-\>set\_filenames(array(‘search\_rules’ =\> ‘search\_rules.tpl’));  
// ±----------------------------------------------------------------------+  
// | Textual rules creation |  
// ±----------------------------------------------------------------------+  
// Rules are stored in database, serialized in an array. This array must be  
// transformed into a list of textual rules.  
**[U][SIZE=4][COLOR=#ff0000][SIZE=4][COLOR=#ff0000]Line 33**[/U]: $search = get\_search\_array($\_GET[‘search\_id’]);  
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=4]if (isset($search[‘q’]))  
{  
$template-\>append(‘search\_words’, $search[‘q’]);  
}  
else  
{  
$template-\>assign(  
array(  
‘INTRODUCTION’  
=\> ‘OR’ == $search[‘mode’]  
? l10n(‘At least one listed rule must be satisfied.’)  
: l10n(‘Each listed rule must be satisfied.’),  
)  
);  
}  
if (isset($search[‘fields’][‘allwords’]))  
{  
$template-\>append( ‘search\_words’,  
sprintf(  
l10n(‘searched words : %s’),  
join(’, ‘, $search[‘fields’][‘allwords’][‘words’])  
)  
);  
}  
if (isset($search[‘fields’][‘tags’]))  
{  
$template-\>assign(‘SEARCH\_TAGS\_MODE’, $search[‘fields’][‘tags’][‘mode’]);  
$query = ’  
SELECT name  
FROM ‘.TAGS\_TABLE.’  
WHERE id IN (’.implode(’,’, $search[‘fields’][‘tags’][‘words’]).’)  
;’;  
$template-\>assign(  
‘search\_tags’,  
array\_from\_query($query, ‘name’)  
);  
}  
if (isset($search[‘fields’][‘author’]))  
{  
$template-\>append(  
‘search\_words’,  
sprintf(  
l10n(‘author(s) : %s’),  
join(’, ‘, $search[‘fields’][‘author’][‘words’])  
)  
);  
}  
if (isset($search[‘fields’][‘cat’]))  
{  
if ($search[‘fields’][‘cat’][‘sub\_inc’])  
{  
// searching all the categories id of sub-categories  
$cat\_ids = get\_subcat\_ids($search[‘fields’][‘cat’][‘words’]);  
}  
else  
{  
$cat\_ids = $search[‘fields’][‘cat’][‘words’];  
}  
$query = ’  
SELECT id, uppercats, global\_rank  
FROM ‘.CATEGORIES\_TABLE.’  
WHERE id IN (’.  
implode(’,’, $cat\_ids).  
‘)  
;’;  
$result = pwg\_query($query);  
$categories = array();  
if (!empty($result))  
{  
while ($row = pwg\_db\_fetch\_assoc($result))  
{  
array\_push($categories, $row);  
}  
}  
usort($categories, ‘global\_rank\_compare’);  
foreach ($categories as $category)  
{  
$template-\>append(  
‘search\_categories’,  
get\_cat\_display\_name\_cache(  
$category[‘uppercats’],  
null, // no url on category names  
false // no blank replacement  
)  
);  
}  
}  
foreach (array(‘date\_available’, ‘date\_creation’) as $datefield)  
{  
if (‘date\_available’ == $datefield)  
{  
$lang\_items = array(  
‘date’ =\> l10n(‘posted on %s’),  
‘period’ =\> l10n(‘posted between %s (%s) and %s (%s)’),  
‘after’ =\> l10n(‘posted after %s (%s)’),  
‘before’ =\> l10n(‘posted before %s (%s)’),  
);  
}  
elseif (‘date\_creation’ == $datefield)  
{  
$lang\_items = array(  
‘date’ =\> l10n(‘created on %s’),  
‘period’ =\> l10n(‘created between %s (%s) and %s (%s)’),  
‘after’ =\> l10n(‘created after %s (%s)’),  
‘before’ =\> l10n(‘created before %s (%s)’),  
);  
}  
$keys = array(  
‘date’ =\> $datefield,  
‘after’ =\> $datefield.’-after’,  
‘before’ =\> $datefield.’-before’,  
);  
if (isset($search[‘fields’][$keys[‘date’] ]))  
{  
$template-\>assign(  
strtoupper($datefield),  
sprintf(  
$lang\_items[‘date’],  
format\_date($search[‘fields’][$keys[‘date’] ])  
)  
);  
}  
elseif (isset($search[‘fields’][$keys[‘before’] ])  
and isset($search[‘fields’][$keys[‘after’] ]))  
{  
$template-\>assign(  
strtoupper($datefield),  
sprintf(  
$lang\_items[‘period’],  
format\_date($search[‘fields’][$keys[‘after’] ][‘date’]),  
inc\_exc\_str($search[‘fields’][$keys[‘after’] ][‘inc’]),  
format\_date($search[‘fields’][$keys[‘before’] ][‘date’]),  
inc\_exc\_str($search[‘fields’][$keys[‘before’] ][‘inc’])  
)  
);  
}  
elseif (isset($search[‘fields’][$keys[‘before’] ]))  
{  
$template-\>assign(  
strtoupper($datefield),  
sprintf(  
$lang\_items[‘before’],  
format\_date($search[‘fields’][$keys[‘before’] ][‘date’]),  
inc\_exc\_str($search[‘fields’][$keys[‘before’] ][‘inc’])  
)  
);  
}  
elseif (isset($search[‘fields’][$keys[‘after’] ]))  
{  
$template-\>assign(  
strtoupper($datefield),  
sprintf(  
$lang\_items[‘after’],  
format\_date($search[‘fields’][$keys[‘after’] ][‘date’]),  
inc\_exc\_str($search[‘fields’][$keys[‘after’] ][‘inc’])  
)  
);  
}  
}  
// ±----------------------------------------------------------------------+  
// | html code display |  
// ±----------------------------------------------------------------------+  
$template-\>pparse(‘search\_rules’);  
include(PHPWG\_ROOT\_PATH.‘include/page\_tail.php’);  
?\>  
Thanks in advance,  
Scotty13  
　  
[/SIZE]
