I've been learning MySQL on my own and just have a few questions on how to go about thinking in SQL
I want to have this scenario
The user registers to a test site I have, from there they fill out the usual data and it stores it to the `users` table with the `id` auto_increment.
so then they fill out a contact form.
saves the data to my `contact` table with an id of `contact_id` in my limited logic on how i would go about getting the contact data to match up with the user data so
that it outputs in the about_me.php page is to just set the `contact_id` = `id` from the `users` table and when ever i want the output data from the user i can just
tell the SQL queries to look for all tables that match the `id` from the `users` table right?. This way contact data isn't accessed or accidentally shown to another user right?
I'm thinking small and simple right here, I was hoping to have at least another 4 tables with different information about a single user. Its simple with only one user.
But if i have say 5 users then I was wondering how to create the SQL to match all data with its correct owner.
I'm not asking for someone to code for me, but just some insight on how to tackle this problem. I can research on my. But if you would like to show
me examples or working code that I can learn from then I would really appreciate it.
Question
saiya
Hi guys,
I've been learning MySQL on my own and just have a few questions on how to go about thinking in SQL
I want to have this scenario
The user registers to a test site I have, from there they fill out the usual data and it stores it to the `users` table with the `id` auto_increment.
so then they fill out a contact form.
saves the data to my `contact` table with an id of `contact_id` in my limited logic on how i would go about getting the contact data to match up with the user data so
that it outputs in the about_me.php page is to just set the `contact_id` = `id` from the `users` table and when ever i want the output data from the user i can just
tell the SQL queries to look for all tables that match the `id` from the `users` table right?. This way contact data isn't accessed or accidentally shown to another user right?
I'm thinking small and simple right here, I was hoping to have at least another 4 tables with different information about a single user. Its simple with only one user.
But if i have say 5 users then I was wondering how to create the SQL to match all data with its correct owner.
I'm not asking for someone to code for me, but just some insight on how to tackle this problem. I can research on my. But if you would like to show
me examples or working code that I can learn from then I would really appreciate it.
Thx guys
Link to comment
Share on other sites
5 answers to this question
Recommended Posts