Gossamer Forum
Home : Products : Gossamer Links : Version 1.x :

new field for search

Quote Reply
new field for search
i need a second field for search which can be searched by alone without the query field.

e.g.: a field for the zip-code where people can search all records for a special zip-code without entering anything else in the query field.

How can i do this?

Quote Reply
Re: new field for search In reply to
This has been discussed before, many times. Several solutions are available here in the forums.

There is not "one" answer, so you might have to look at message headers for a couple of months, or do some searches for "zip" and see if that gives you a starting point.

No answer is "easy". All require some programming knowledge and HTML form knowledge.

http://www.postcards.com
FAQ: http://www.postcards.com/FAQ/LinkSQL/

Quote Reply
Re: new field for search In reply to
Hi,

I had the same problem, maybe this is another way where you can find a solution. I posted this already but I donīt know how to refer to the thread, so:
Finally we found the easy mod to search for any col:
Replace:
# Now let's search the links table, but first figure out any filters.
$linkdb = new Links::DBSQL "$LINKS{admin_root_path}/defs/Links.def";
my %filter = ();
foreach my $col (@{$linkdb->{db_cols}}) {
if ($in->param($col)) {
$filter{$col} = $in->param($col);
}
}
$link_hits = $linkdb->query ( { query => $query, mh => $mh, nh => $nh, filter => \%filter, ww => $ww } );
$link_count = $linkdb->hits || 0;
$link_errors = $linkdb->query_errors;

with:
# Now let's search the links table, but first figure out
# any filters.
my $idsinfo;
$linkdb = new Links::DBSQL "$LINKS{admin_root_path}/defs/Links.def";
my %filter = ();
foreach my $col (@{$linkdb->{db_cols}}) {
if ($in->param($col)) {
$filter{$col} = $in->param($col);
}
}

if ($in->param('IDS'))
{
$idsinfo = $in->param('IDS');
}
else
{
$idsinfo = 'query';
}
$link_hits = $linkdb->query ( { $idsinfo => $query, mh => $mh, nh => $nh, filter => \%filter, ww => $ww } );
$link_count = $linkdb->hits || 0;
$link_errors = $linkdb->query_errors;

Now you can enter a query like:
http://www.yourdomain.com/cgi-bin/search.cgi?query=15&IDS=ID
to display the Link with ID 15


http://www.master-productions.com
Quote Reply
Re: new field for search In reply to
This code is great for searching 1 field, but what if you want to have a text query and search a second field too.

Thanks