I have to create a registration form through which data will be entered into two tables one the profile table n other the address table. The problem is that i have to enter the address id of address table simultaneously into the profile table. now i dont know how to take the output of select query through which i retreive the address_id and insert it into the profile table.

Uhmm, so basically one profile can has multiple address link to it? that is your relation between both tables?

its like one table consists of user details n other table has address details. the add_id of the corresponding address of the user has to be entered in user detail table.

2 tables Profile & Address
Profile Contains Address_ID, lot more fields and Address Contains Address_ID,Address1,Address2

Select Address.Address1,Address.Address2 from Profile,Address where Profile.Address_ID = Address.Address_ID

hope that helps!

I have to create a registration form through which data will be entered into two tables one the profile table n other the address table. The problem is that i have to enter the address id of address table simultaneously into the profile table. now i dont know how to take the output of select query through which i retreive the address_id and insert it into the profile table.

You had problem that you put address_id in both table but when you retrieve that you selected a address_id from specific table you choose,when you fire a select query then mentioned a "select a address_id from a address;" if you want from profile then same query you fire instead of address you put profile table name,and you make a join for this table then you retrieve your answer.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.