How to combine get id's and mysql?

For an example:
I want to create a profile page to different users with different id’s.
profile.php?id=1, profile.php?id=2, ?id=3, etc.

How do I deside which data will appear for an specific user (refer to his specific id) in his profile page?

This question might be stupid, and you might want to tell me to go learn these subjects again.
But I’ve learned about $_GET and about mysql databases - I just can’t figure out by myself how to combine these two for my goal.

Please help me.

No such thing as a stupid question. There’s a few ways of going about this, but the simplest way is use sessions. I don’t know what your login script looks like, but add something like $_SESSION[‘auth’] = 1;, then on the profile page, do something like:
[php]
if($_SESSION[‘auth’] != 1) {
// what ever you want to put if the user id’s don’t match
} else {
// display their profile information
}[/php]

You can use that same session to prevent someone from going directly to that page, so that they have to login first.

This wasn’t my question.
To make it more clearly, how can I, for example, edit text in page.php?id=3 ?
I know this has something to do with mysql, I just don’t know how to write it.

Query for it. mySQL_query(“select * from table where id=$_get[id]”);

Just like that? Is it that easy?

yea, its not that complicated.

Sponsor our Newsletter | Privacy Policy | Terms of Service