Gossamer Forum
Home : Products : DBMan : Installation :

Adding a new result

Quote Reply
Adding a new result
Hi,

On my homepage at http://www.koshervitamin.com I've set up that it should automatically go to an html.pl that I've created for the homepage. The sub html_home is set that it should look in a database that I've created just for the special products, and list all the items there, (currently 2 items).

I've done this by first adding at the top of the sub html_home routine
Code:
$in{'Special'} = "Yes";
my ($status,@hits) = &query("view");
Then where I wanted to print out the specials I added
Code:
if ($status eq "ok") {
&html_record (&array_to_hash($_, @hits));

This is working just great, but here's my question. I have another part on that page called "What's New". I want the script to look through the same database as the Specials, but this time list all items that have $in{'Whats New'} = "Yes" (it will only be 1 item since that's the only room I have).

So you see my problem. If I just do the same as the specials and go
Code:
if ($status eq "ok") {
&html_record_whatsnew (&array_to_hash($_, @hits));
It's going to look for the "specials" and not the "What's New".

I hope you understand my question.

Thank You
Eli
Quote Reply
Re: Adding a new result In reply to
So you have two links that the user clicks -- one for "Specials" and one for "What's New," right?

In the "Specials" link, use

&Special=Yes

and in the "What's New" link, use

&WhatsNew=Yes

Then, when you print out the results, use

Code:
my ($status,@hits) = &query("view");
if ($status eq "ok") {
if ($in{'Special'} eq "Yes") {
&html_record (&array_to_hash($_, @hits));
}
elsif ($in{'WhatsNew'} eq "Yes") {
&html_record_whatsnew (&array_to_hash($_, @hits));
}
}

Is that what you wanted?

------------------
JPD