Reply
Advice on database issue
Old 11-07-2009, 12:26 PM Advice on database issue
Novice Talker

Posts: 14
Trades: 0
Hi there,

I am making a site to allow people to make their own profiles, just need some advice to get my head in the right direction.

Once a person has filled out a form of say:

username
password
name
age
etc.

It will insert them values into the database. But if I want to display this information on their profile page so others can see too, how would this be done. Obviously through SQL statements, but my confusion is that once they have inserted this information, how will i get the correct information to show on the profile, which this person has inserted. How can this be generated automatically to the page, without having to know their userID or username prior.

so in the name field of the page you would have a statement like

$query = SELECT name FROM person WHERE ID = 1;

but if they have just filled out the member form, how will you straight away see the profile information they have entered when they press submit as you wouldnt know the ID that they are?

sorry if this is confusing to read, its hard to explain what i mean in words.

Thanks in advance

applebiz
applebiz89 is offline
Reply With Quote
View Public Profile
 
 
When You Register, These Ads Go Away!
Old 11-07-2009, 12:54 PM Re: Advice on database issue
Bertjeuh's Avatar
Average Talker

Posts: 15
Name: Bert Van Leemput
Trades: 0
I dont know what you mean, normally I do it like this.

- the user fills in a form (username, name, password, ...)
- you put this in a database and you make a session:
INSERT INTO users (name, username, password, ...) VALUES ($username, $password, ...);

session_start();
$_SESSION['name'] = $_POST['username'];

- Then you can do your query like this:
$query = SELECT * FROM person WHERE name = $_SESSION['name'];
__________________
There Are Only 10 Types of People in the World: Those Who Understand Binary, and Those Who Don't.
Bertjeuh is offline
Reply With Quote
View Public Profile
 
Old 11-07-2009, 01:11 PM Re: Advice on database issue
Mad182's Avatar
Experienced Talker

Posts: 41
Name: Madars
Location: Latvia
Trades: 0
http://php.net/manual/en/function.mysql-insert-id.php
__________________
There's no place like 127.0.0.1
latvian guitar chords | runescape community
Mad182 is offline
Reply With Quote
View Public Profile Visit Mad182's homepage!
 
Old 11-07-2009, 02:23 PM Re: Advice on database issue
King Spam Talker

Posts: 1,412
Trades: 0
The username or id is determined when someone clicks on the link to see the page. The page data is presented based on a sql query based on the link clicked.

If I did not explain that well enough tell me how you propose to have people see a particular profile and I will try to be more definate.
__________________
Colbyt
colbyt is offline
Reply With Quote
View Public Profile
 
Old 11-07-2009, 03:24 PM Re: Advice on database issue
Novice Talker

Posts: 14
Trades: 0
thanks, the session one makes alot of sense to me.

and i propse them to see their profile initially once they have submitted the form, and when they log on to the site they can see their profile and view others. I was just confused how i could make it determine each individual persons profile without manually making it to
applebiz89 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Advice on database issue
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 



Page generated in 0.21866 seconds with 13 queries