ChronoEngine.com homepage

Forums

Please write a review for the extension you are using on the Joomla extensions directory before posting a new question as we are being spammed by many negative reviews.

Thank you for your support!

Relating two tables with foreign key

kkurtz 01 Jan, 2018
I am trying to relate two tables: one is the Joomla users table (primary key is id) and the other is a user information table. Both tables contain the username. But I don't want to make the primary key the username in the information table because I need to allow multiple records for some of the usernames. How can I use the foreign key to match the two tables? I would rather not force the second table to have the id field if I can help it.

Thank you,
Karen
Max_admin 04 Jan, 2018
Hi Karen,

The usual setup is to have the 2nd table have a field named "user_id" which contains the user id from the first table, then you can use user_id as the foreign key and select the relation type as "multiple matching" if you are going to have multiple records per user.

Best regards
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
kkurtz 05 Jan, 2018
Answer
1 Likes
So I guess I'll have to find a way to add the user_id to my second table.

Thanks, Max
This topic is locked and no more replies can be posted.

2Checkout.com

2CheckOut.com Inc. (Ohio, USA) is an authorized retailer for goods and services provided by ChronoEngine.com