Gossamer Forum
Home : Products : DBMan : Customization :

modify two databases when validated

Quote Reply
modify two databases when validated
Hi...I have two database files, a product date base and a comment database....they run seperately....when you call up a product it includes a link to make a comment as well as a link to read comments...as many as 30 products can be called up at a time....at the moment I have the product page query the comment database to see if there are any comments....could be thirty times....this is too slow....

What I need: comments added to the comment database are validated before they are shown....I have that installed and running.....I need the comment database cgi to open the product database and write to a specific field when a comment is validated...if there are no comments the field in the product data base would be blank....so, if there are comments a link will appear in the product listing, if there are no comments then no link would show up.....

Once a comment is validated it will stay there....there need not be any coding to reverse the entry into the product database.

I'm pretty sure I simply want to tack this onto the bottom of the comment validate sub....but I'm unsure how to define the product datafile and such.

Any help.

regards Steven
Quote Reply
Re: [stevensteven] modify two databases when validated In reply to
Do you have one field that the two databases have in common?

I'm thinking that perhaps setting it up as a relational database would help you to search quicker, only show a link for validated records, etc.

JPDeni's relational mod example files I believe are for her book store which links book to reviews and would be a great example for you to check out. The mod's .zip files are available on her site at http://jpdeni.com/dbman

There are also some other options if you don't choose to setup the relational mod to do this.

Have you by any chance checked the FAQ noted below under the section "muliple databases" or "linking"?

I'm thinking that may be easier than trying to have one database update another during the validation process.

Unoffical DBMan FAQ

http://creativecomputingweb.com/dbman/index.shtml/
Quote Reply
Re: [LoisC] modify two databases when validated In reply to
LoisC, thank you for the quick response...

I've had a look at Linking, Multiple Databases and the Relational Mod.

I do have a common field in both databases.

Some other details.....the main database, products, is not a dbman database, thought it is a flat text file database, also delimited by |'s . That's part of the reason I wanted to write to it when the admin validated entries in the comment database. I thought that would be easier, knowing I had a validated comment I could just write a link to the comment(s).

At the moment I'm having the main database spit out a query to the comment database along with the normal product info....if there are no validated comments then I've got it returning "no comments" (I simply butchered the "no items found" page and removed the links on the bottom) and if there are validated comments then it returns a search string for the user to click on. The comments then open in a pop up box. The problem is that there can be up to 30 different product items returned....and 30 different queries of the comment database all at the same time...

Any thoughts now?
Quote Reply
Re: [stevensteven] modify two databases when validated In reply to
change of plans.....I've found a different way of doing things.....a way that should be better....and doesn't even actually use dbman....thanks lois