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

7 Years
Discussion Span
Last Post by pzuurveen

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

tabel user:
user_id (primery key)

table contact
contact-id (primeyy key)
user_id (foren- key form tabel user)

Edited by pzuurveen: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.