Jump to content

Question


Immortal55

Recommended Posts

When you make a user system on a website using databases and php, and you want users to have a 'user profile' does a page essentially have to be created when they register with the website, or what? If a page is created when they register, how do i go about doing that?
Link to comment
Share on other sites

[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]does a page essentially have to be created when they register[/quote]
No... You store there profile infomation in a database, then call there data on a [i]profile.php[/i] page.
Link to comment
Share on other sites

[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]does a page essentially have to be created when they register[/quote]
No... You store there profile infomation in a database, then call there data on a [i]profile.php[/i] page.
Link to comment
Share on other sites

I would suggest that you have a "members" page that is sorted some way - even if it just sorts them by id descending. Each member's username would be a link to something like /profile.php?user="usernamehere"..
Then you could populate sections of that page by getting the member's info from the database.

Something like:


[code]$sql = mysql_query("SELECT * FROM members WHERE username='{$_REQUEST['user']}'");[/code]

then you could simply use a while loop to make the user's info into simply variables:

[code]while($row = mysql_fetch_assoc($sql)){

//this next line will make all the array variables into normal variables - if you had a "last_name" field in the database you could now call it simply by using $last_name
stripslashes(extract($row));

echo $username;
echo $last_name;
}
[/code]

This is just an example of how to do it, not full blown code as I have neither the time, or your database setup etc... Anyway, if you need any more help, just ask :)

-austen
Link to comment
Share on other sites


alright, so if I wanted to have links to user profiles from my db, where the table with the info is titled users, and in the table the names i want displayed are under 'uname' then would my script look like this:

[code]
<?

$conn = db_connect();
if (!$conn)
    return false;
    
    $sql = mysql_query("SELECT * FROM users WHERE
        uname = '{$_REQUEST['user']}'");
        
    while($row = mysql_fetch_assoc($sql){
    stripslashes(extract($row));
    
    echo '<a href="/profile/profile.php?user='.$uname.'>'.$uname.'</a>';
    
}

?>
[/code]

if anything is wrong, please help me out.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.