PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.lang.php > PHP MYSQL Table
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
PHP MYSQL Table

Réponse
 
LinkBack Outils de la discussion
Vieux 27/03/2008, 20h24   #1
Dave
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut PHP MYSQL Table

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.

!
  Réponse avec citation
Vieux 27/03/2008, 21h09   #2
sheldonlg
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: PHP MYSQL Table

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.
  Réponse avec citation
Vieux 27/03/2008, 21h10   #3
The Natural Philosopher
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: PHP MYSQL Table

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.
  Réponse avec citation
Vieux 27/03/2008, 21h12   #4
sheldonlg
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: PHP MYSQL Table

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.
  Réponse avec citation
Vieux 27/03/2008, 21h21   #5
sheldonlg
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: PHP MYSQL Table

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)
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 18h13.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,11261 seconds with 13 queries