Gossamer Forum
Home : Products : DBMan : Customization :

Multi databases

Quote Reply
Multi databases
Hi to JPDeni, thanks for your info on DBman so far. I have a topic you've covered before but not in this way, I think? What I'm trying to create is a single db interface with multiple .db and .cfg files. Users can search the database through a search form that requires no login, with one of the fields choosing the different .db file. This works okay, however I would like the adding, deleting etc. sub routines to be able to use a field to select where the record is posted. How should I include a field to do this? I have tried linking a fields value to $db_setup however this doesn't work?

All help greaatly appreciated.
Quote Reply
Re: Multi databases In reply to
Could you post the code you used to link the field value to the $db_setup variable?


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





Quote Reply
Re: Multi databases In reply to
I thought something like:

$db_setup = $rec{'Type'};

under the html globals in html.pl where
$rec{'Type'} is a list field with the three db. files.I know there is probably mods to be made in db.cgi also. By default the database is say one.db, the admin has to enter details selecting value for
$rec{'Type'} in add form and then have the info posted to the appropiate db.

I hope this is clearer to you than it is to me. Do you think this is a big mod?

Thanks in advance
Fordy.
Quote Reply
Re: Multi databases In reply to
I would go about it a completely different way. One thing is that, by the time the global variables have been defined, the database has already been determined.

Look at the beginning of db.cgi. Right after

local(%in) = &parse_form;

Try adding

Code:
if ($in{'Type'}) {
$in{'db'} = $in{'Type'};
}

That would assume that there is a matching .cfg file for every possible value of the Type field.



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





Quote Reply
Re: Multi databases In reply to
Success! So simple a mod.
As always your help is greatly appreciated JPDeni. Your work on this forum has been great.

Without your help I see I was heading in the wrong direction.

Thanks again,
Fordy