/    Sign up×
Community /Pin to ProfileBookmark

Displaying Infomation from php/mysql Database

I want to show the infomation on my database on a seperate page for each of my users. A Profile page is what I want to make. What ever info you enter, I want to have a page displaying the info you entered. Thanks for any help

to post a comment
PHP

6 Comments(s)

Copy linkTweet thisAlerts:
@Reli4ntDec 18.2005 — put the info in the db along with the user id as a foreign key if need be,

then once theyve logged in stick the user_id in a session

whenever they hit the profile page run a "SELECT * FROM whatever table or tables WHERE user_id = $_SESSION['user_id']" query.
Copy linkTweet thisAlerts:
@kylixauthorDec 18.2005 — how do I create that profile page. I have the outline of how I want it to look, but I don't know how to display the infomation from the user. I have to graphics for the page, but not the info.
Copy linkTweet thisAlerts:
@Reli4ntDec 19.2005 — What exactly do you need to know? Or rather what do yo already know?

have you created a db?

have you populated the db with user info or at least figured out how it will happen?

do you know how to set up a login for a user?

do you know how to manage sessions?

do you know how to write select statements?
Copy linkTweet thisAlerts:
@kylixauthorDec 19.2005 — I have created a db.

I populated the db with user info and figured out how it will happen.

I know how to set up a login for a user

But I don't know how to manage sessions.

I kinda of know how to write select statements.

I guess my question is to generic. You see how when you registered for this forum you had to enter a bunch of infomation about yourself. I have form through PHP that did that. What I want is a page that shows that information, something similiar to an user CP. I want your info displayed after you sign up. How do I pull the information from my database and display it on the screen?
Copy linkTweet thisAlerts:
@chazzyDec 19.2005 — Well here are some tips on sessions

- use them

- update them constantly

- don't put any secure information (password, credit card, email address, etc) in them - you can get into their values much easier than a database.

- Use a mix of sessions and database. if you want to keep track of someone's rights, think about how can they change. should these changes happen instantly (on next page view) or on next session? if it's possible that someone will be kicked out, you'll want them kicked out immediately, not after their current session is over. a database can be used to get this stuff on every page view. or even before that if you want to mix in some asynchronous javascript requests.

as for your question

- you want a form to view it? are you familiar with get and post arrays? you can write your select statement to pull up the information for a user based on their get. anyone can [b]view[/b] another's information, depending on access rights, but only 1 person should be able to edit it.
Copy linkTweet thisAlerts:
@Reli4ntDec 20.2005 — basically the minimum you'd need to know regarding sessions is to put session_start() at the head of every page and to create a session variable is as easy as
[code=php]$_SESSION['variable'] = $variable;[/code]

take a look at php.net though for more info on [URL=http://us2.php.net/manual/en/ref.session.php]sessions[/URL].

You will really need to learn basic SQL, especially SELECT statements. Mine usually look something like:
[code=php]$sql = "SELECT column FROM table WHERE column = 'value'";[/code]

Read up on [URL=http://www.w3schools.com/sql/sql_select.asp]select statements[/URL] and php's [URL=http://us2.php.net/manual/en/ref.mysql.php]mysql functions[/URL] and then experiment.

Beyond that you will need to be more specific.
×

Success!

Help @kylix spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...