Hello everyone,

I have got class system going on where object is created for each column in mysql table upon initialization of the class.

This class contains one particular attribute($this->table) where i set my table name. This attribute helps in constructing a query when user press "add" to add stuff in the DB via HTML page.

It works fine as it is but I am now faced with a situation where i am required to update two tables simultaneously.

Lets say my HTML page has 3 columns "tel", "mobile", "email" which are in table "contacts". So when i press 'add' it grabs the table name from this->table when constructing a insert into query and adds it to DB.

Now, i have another column 'name' which is in another table, 'user'. I will be displaying the contents of 'name' on a HTML page constructed via class which is not a problem. The problem is when user decides to update the 'name'!

I have an issue here because my add button will go and look into this->table to find the name of table but now, since i have two tables to update, how to accomplish that!!!

Your help is much appreciated

i would use the the primery-key as reverns
sometin like:

tabel user:
user_id (primery key)
name
...

table contact
contact-id (primeyy key)
user_id (foren- key form tabel user)
tel
mobile
email
...

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.