|
|
|
#1 |
|
Messages: n/a
Hébergeur: |
Ok so i have a database with a table users. The users each have a
unique id. Now i want to create another table called profile where the users can edit their profile and it will be stored in the profile table. But i need to somehow connect the tables together so when the user saves itll save the information in the table profile under their id that they have in the users table. ! |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
Dave wrote:
> Ok so i have a database with a table users. The users each have a > unique id. Now i want to create another table called profile where the > users can edit their profile and it will be stored in the profile > table. But i need to somehow connect the tables together so when the > user saves itll save the information in the table profile under their > id that they have in the users table. > > ! The level of the question you are asking is SQL 101. I suggest you do a little studying on elementary sql, and there are a multitude of places on the web with tutorials (just google "sql tutorial"). In answer to your question, the second table (tblProfile) would have a column called, say, userID, and that would contain the ID from the first table, users, for that user. You connect the two with a join either by having a where clause (where tblProfile.userID = users.ID) or with a join statement (join tblProfile on (tblProfile.userID = users.ID). Really, though, this IS just SQL 101. |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
Dave wrote:
> Ok so i have a database with a table users. The users each have a > unique id. Now i want to create another table called profile where the > users can edit their profile and it will be stored in the profile > table. But i need to somehow connect the tables together so when the > user saves itll save the information in the table profile under their > id that they have in the users table. > > ! Select *from profile, user where profile.user=$userid update profile set () where profile,.user=$userid. |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
Dave wrote:
> Ok so i have a database with a table users. The users each have a > unique id. Now i want to create another table called profile where the > users can edit their profile and it will be stored in the profile > table. But i need to somehow connect the tables together so when the > user saves itll save the information in the table profile under their > id that they have in the users table. > > ! Another suggestion is to get a copy of MS Access. It has a good graphical query builder. After you build the query, look at the SQL statement. You can learn a lot that way in the beginning stages of learning SQL. |
|
|
|
#5 |
|
Messages: n/a
Hébergeur: |
The Natural Philosopher wrote:
> Dave wrote: >> Ok so i have a database with a table users. The users each have a >> unique id. Now i want to create another table called profile where the >> users can edit their profile and it will be stored in the profile >> table. But i need to somehow connect the tables together so when the >> user saves itll save the information in the table profile under their >> id that they have in the users table. >> >> ! > > Select *from profile, user where profile.user=$userid > > update profile set () where profile,.user=$userid. No comma before the .user (we all make typos) |
|
![]() |
| Outils de la discussion | |
|
|