Gossamer Forum
Home : Products : DBMan : Customization :

1 default.cfg and html.pl file - 2 .db files...

Quote Reply
1 default.cfg and html.pl file - 2 .db files...
I have 1 default.cfg, 1 db.cgi and 1 html.pl file but I would like to have 2 default.db files.

I'll try to explain in detail what I want to do:

I'm trying to create a pen pals page and I would like to keep the men and women information in 2 separate .db files, let's say male.db and female.db

Now when a user logs in the database and choses to search for women then he would only search within the female.db file. If one wants to search for men he would search within the male.db file.

Does this make sense and is it possible to be done?

Also one more question:
The database should be open to anyone to search but only registered users should be able to add/modify/delete their own profile.
Would this work if I have 2 .db files?
I mean if a woman searches the database for men and then decides to add her profile, would this work?
I mean logically since she's searching for men she would have the "male.db" file open. But then if she wants to add a profile she should be able to close the "male.db" file and open the "female.db" file.

I hope I make sense...
Any help would be greatly appreciated!

Quote Reply
Re: 1 default.cfg and html.pl file - 2 .db files... In reply to
You cannot have two databases and one config file...without heavily hacking the db.cgi script.

You need to have two config files and your best bet is to install the Relational Mod.

Regards,

Eliot Lee
Quote Reply
Re: 1 default.cfg and html.pl file - 2 .db files... In reply to
Using 2 .cfg files would be best and you would not have to use the relational mod to accomplish what you need.

You could add links to each database within your footers.
For examples of how to do this look in the FAQ noted below under "Multi & Relational".

Remember in your links between databases to use:

$db_script_url

instead of:

$db_script_link_url



Unoffical DBMan FAQ
http://webmagic.hypermart.net/dbman/
Quote Reply
Re: 1 default.cfg and html.pl file - 2 .db files... In reply to
Thank you both for your replies.
I understand that it's much easier to use 2 .cfg files but my question is:

Is there any way I can use an IF statement in the .cfg file so IF the user selects "male" on the drop down then the "male.db" is loaded else if he choses "female" the "female.db" is loaded?

Can I do that in the .cfg file or do I have to set this IF ELSE statement in the db.cgi?

If there's no other way I guess the easiest way is LOISC's solution. I could also have a static html page and set the drop down so that if for example "male" is selected then the "male.db is loaded.

Could something like that work?:

<FORM ACTION="/cgi-bin/default.cgi" method="GET">
<INPUT TYPE=hidden name="uid" value="default">
<SELECT NAME="db">
<SELECT value="male.db"> Male
<SELECT value="female.db"> Female
</SELECT>

The problem is that if I do it that way I'll have to get all the users through a "Male-Female" selection page (static) all the time before they search, add or modify anything.
I guess that would be kind of annoying.

If anyone has a better idea I would be glad to hear it!
Thanks for the help!

Quote Reply
Re: 1 default.cfg and html.pl file - 2 .db files... In reply to
What you could do .. which maybe is not the best solution would be to provide links on the home page of each database to go to the various functions.

You could list:

Ladies add your profile
Modify your profile

Gentlemen add your profile
Modify your profile

Then they would only have to goto the main pages of each database to choose what they want to do.

Just an idea

Unoffical DBMan FAQ
http://webmagic.hypermart.net/dbman/