Gossamer Forum
Home : Products : DBMan : Customization :

if...else... syntax

Quote Reply
if...else... syntax
If the search results return only 1 record I want to display:

There is only 1 recod found.

If there are more records returned, that it has to display;

There are 25 records found.

I have now:
Code:
Quote Reply
Re: [Foton] if...else... syntax In reply to
In sub html_view_success it does have:

Your search returned <b>$db_total_hits</b> matches.

Do you mean you want to reword this? Or are you using the short/long mod and you want it to default to the short display regardless of whether there is only 1 record?

Unoffical DBMan FAQ
http://redundantcartridge.com/dbman/
Quote Reply
Re: [LoisC] if...else... syntax In reply to
Whauw, that's fast!

I was trying to edit my message, because I could not get my code properly in the "Quote" box, and you already made a reply!

Yes, it's in the html_view_success. I use the regular html.pl and not the short/long version. So here is it again:

If the search results return only 1 record I want to display:

There is only 1 record found.

If there are more records returned, that it has to display;

There are 25 records found.

I have now:

|;
if ($rec{'$db_total_hits'} == 1) {print qq|
There is only <b>$db_total_hits</b> record found. |;} else {print qq| There are <b>$db_total_hits</b> records found.
|;}

but it still shows the line for the 'more then 1' records.

What am I doing wrong here.

Last edited by:

Foton: Oct 2, 2002, 4:40 PM
Quote Reply
Re: [Foton] if...else... syntax In reply to
There is someone who posted how to change it... let me look in my notes and see if I can find the solution for you.

Give me a few minutes while I look.

Unoffical DBMan FAQ
http://redundantcartridge.com/dbman/
Quote Reply
Re: [LoisC] if...else... syntax In reply to
Found it and it worked!

Post is on:

http://www.gossamer-threads.com/..._total_hits%27;#2519

Why is it that every time I get stuck and I post on this forum, just then I find the answer and not before, huh?

Thank you LoisC for the quick response.
I read your faq very often for advice.
Keep up the good work!
Quote Reply
Re: [Foton] if...else... syntax In reply to
Code:
print qq!Your search returned $db_total_hits hit!;
print qq!s! unless $db_total_hits == 1;

Smile