Gossamer Forum
Home : Products : DBMan : Customization :

Search by Clicking on A Link

Quote Reply
Search by Clicking on A Link
I would like to put in a search where if the gender is male, it will search the fathers field for that entries name and ID Number. If the gender is female it will search the mothers field for that entries name and ID Number, in result giving a list of the children by the particular entry.

This link would be on the entries information. you can look at my database currently by going to
http://www.gcshc.com/cgi-bin/registry/db.cgi

I'm looking for something similar to the Vet and Farrier links on there
Quote Reply
Re: [GCSHC] Search by Clicking on A Link In reply to
Are you searching within the same database or another one like the Farrier links?

How are you fields for gender defined. You may have problems search for male and female as female also contains male. You may want to use F and M to specifiy the gender.

Are these current fields within your database?

You may want to try using something like what is used in this thread:

Displaying Related records in html_record_long
wretchedhive
14-Aug-2002
http://gossamer-threads.com/p/210878

Hope this helps

Unoffical DBMan FAQ

http://creativecomputingweb.com/dbman/index.shtml/
Quote Reply
Re: [LoisC] Search by Clicking on A Link In reply to
Field Name is Gender and the responses are Stallion, Gelding, Mare and Spayed Mare. I've got something that works for now but I couldn't use multipul arguments in one statement, only one argument per statement.

If (defined) {Do this}
Else (Defined) {Do This}

was all I could use I was trying to make the following work

If (defined) {do this}
Elseif (defiend) {do this}
Else (Defined) {do this}

Code:

|;
if ($rec{'Gender'} eq 'Stallion') {
print qq|
<$font_color2><A HREF="http://www.gcshc.com/cgi-bin/registry/db.cgi?db=default&uid=$db_uid&&Sire=$rec{'GCID'}&view_records=View+Records">Progeny</a></font><br>
|;

}
else {
print qq|
<input type="hidden" NAME="Genetics" VALUE="$rec{'Genetics'}">
|;

}
print qq|
|;
if ($rec{'Gender'} eq 'Gelding') {
print qq|
<$font_color2><A HREF="http://www.gcshc.com/cgi-bin/registry/db.cgi?db=default&uid=$db_uid&&Sire=$rec{'GCID'}&view_records=View+Records">Progeny</a></font><br>
|;

}
else {
print qq|
<input type="hidden" NAME="Genetics" VALUE="$rec{'Genetics'}">
|;

}
print qq|
|;
if ($rec{'Gender'} eq 'Mare') {
print qq|
<$font_color2><A HREF="http://www.gcshc.com/cgi-bin/registry/db.cgi?db=default&uid=$db_uid&&Dam=$rec{'GCID'}&view_records=View+Records">Progeny</a></font><br>
|;

}
else {
print qq|
<input type="hidden" NAME="Genetics" VALUE="$rec{'Genetics'}">
|;

}
print qq|
|;
if ($rec{'Gender'} eq 'Spayed Mare') {
print qq|
<$font_color2><A HREF="http://www.gcshc.com/cgi-bin/registry/db.cgi?db=default&uid=$db_uid&&Dam=$rec{'GCID'}&view_records=View+Records">Progeny</a></font><br>
|;

}
else {
print qq|
<input type="hidden" NAME="Genetics" VALUE="$rec{'Genetics'}">
|;

}
print qq|

The above is the code I had to use to make it work, but I know there has to be a simpler way to make it work.
Quote Reply
Re: [GCSHC] Search by Clicking on A Link In reply to
Try using this:

<$font_color2> |;

if ($rec{'Gender'} eq 'Stallion') {
print qq|<A HREF="db.cgi?db=default&uid=$db_uid&Sire=$rec{'GCID'}&view_records=View+Records">Progeny</a>|;
}
elsif ($rec{'Gender'} eq 'Gelding') {
print qq|<A HREF="db.cgi?db=default&uid=$db_uid&Sire=$rec{'GCID'}&view_records=View+Records">Progeny</a>|;
}
elsif ($rec{'Gender'} eq 'Mare') {
print qq|<A HREF="db.cgi?db=default&uid=$db_uid&Dam=$rec{'GCID'}&view_records=View+Records">Progeny</a>|;
}
elsif ($rec{'Gender'} eq 'Spayed Mare') {
print qq|<A HREF="db.cgi?db=default&uid=$db_uid&Dam=$rec{'GCID'}&view_records=View+Records">Progeny</a>|;
}
print qq|</font><BR>


No need to use the full url if you're within the same directory and it will speed up the links. Also I would recommend you turn off bolding in your .cfg file.

$db_bold = 0;

That will prevent what is happening with your Farrier link not finding records.

Unoffical DBMan FAQ

http://creativecomputingweb.com/dbman/index.shtml/

Last edited by:

LoisC: May 31, 2004, 11:04 AM
Quote Reply
Re: [LoisC] Search by Clicking on A Link In reply to
Thanks, I don't know why I couldn't get the else if to work when I was doing it.
Works great now.
Quote Reply
Re: [GCSHC] Search by Clicking on A Link In reply to
I'm so glad it's working for you :)

Unoffical DBMan FAQ

http://creativecomputingweb.com/dbman/index.shtml/