Omar Alhadidy Omar Alhadidy - 5 months ago 10
MySQL Question

Arrange data in MySQL tables

I have a users table and a categories table which already contain data,
I also have a third table which called

which has three

When the user first register he must choose a category or more than one from a dropdown. I want to insert the id of the user to
columns and the id of each category to the
so if the user choose more than one category he will have more than one record in the


Use This

SELECT user_id FROM users ORDER BY user_id DESC LIMIT 1

This will give you the last user_id which has inserted Now by using this user id you can insert the category_id by for each loop or for loop