Click here to get back home

PHP MYSQL Table help

 HomeNewsGroups | Search | About
 comp.lang.php    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
PHP MYSQL Table help Dave 03-27-2008
Get Chitika Premium
Posted by Dave on March 27, 2008, 3:24 pm
Please log in for more thread options
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.

Help!

Posted by sheldonlg on March 27, 2008, 4:09 pm
Please log in for more thread options
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.
>
> Help!

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.

Posted by The Natural Philosopher on March 27, 2008, 4:10 pm
Please log in for more thread options
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.
>
> Help!

Select *from profile, user where profile.user=$userid

update profile set () where profile,.user=$userid.

Posted by sheldonlg on March 27, 2008, 4:21 pm
Please log in for more thread options
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.
>>
>> Help!
>
> Select *from profile, user where profile.user=$userid
>
> update profile set () where profile,.user=$userid.

No comma before the .user (we all make typos)

Posted by Dave on March 27, 2008, 4:46 pm
Please log in for more thread options
Thanks for the help!

Similar ThreadsPosted
mysql: how create a temp table as a copy of a existing table? July 22, 2004, 8:56 pm
Mysql fetch_field gets table alias, not real table name January 6, 2006, 8:01 am
From CSV To MySQL Table May 14, 2007, 2:56 am
reapir mysql table from php September 20, 2004, 6:04 pm
PHP mySQL - table of images October 26, 2004, 7:46 pm
PHP variables from mysql table February 25, 2005, 6:10 am
Problem with MySQL table June 25, 2005, 2:18 am
creating a table via mysql July 4, 2005, 9:39 pm
MYSQL table backups April 29, 2006, 4:59 pm
New PHP/MySQL Table Editor July 24, 2006, 3:33 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap