querying and placing data in 2 databases

A

Anonymous

Guest
am very new to php and mysql. Can anyone give me an idea how I might do the following. I am creating a system whereby researchers can change their CVs that are published on our website. I have two databases: DB1 contains all the information from each investigators CV, DB2 will be the inscription database where they will register to be able to modify their CVs.

It seems to me that the email field in both databases will be the best initial link between the two. That is, if they are inscribing (which would be into DB2) I need something like

if $Post`_[email2] = email1 in DB1 then INSERT all data from the form into DB2

BUT

what I would also like to INSERT the ID generated in the inscription (DB2) into an ID field in DB1 so I can use that ID field for further selections and queries.

I hope I have explained myself well enough. If you could just give me a little idea on how to go about this I would really appreciate it. Thanks
 
Why do you need two databases? I don't know what a "CV" is, but storing the same sort of information in two different databases is pointless.
 
cv=curriculum vitae=resume

the same information isn´t stored in the two databases

one is the inscription database which is info like password, user, date of inscription, number of visits, etc.

the other database contains all the information of the resume, degrees, publications, etc
 
Okay, so I see the need for two tables. But why two databases?

Anyway, in PHP you can use mysql_insert_id() to get the last ID that was inserted. That way you can create a new record with the same ID in the other table. From the sounds of it, you've got a lot of work ahead of you. You're dealing with a number of different datatypes ("resume, degrees, publications, etc") that you're going to have a lot of trouble fitting into a single row. It's highly likey that you're going to have to rely on foreign keys a lot more than you realize.
 
Back
Top