Jump to content


Photo

Question


  • Please log in to reply
5 replies to this topic

#1 Immortal55

Immortal55
  • Members
  • PipPipPip
  • Advanced Member
  • 59 posts

Posted 14 March 2006 - 02:19 PM

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?

#2 trq

trq
  • Staff Alumni
  • Advanced Member
  • 31,041 posts

Posted 14 March 2006 - 02:54 PM

[!--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 profile.php page.

#3 trq

trq
  • Staff Alumni
  • Advanced Member
  • 31,041 posts

Posted 14 March 2006 - 02:54 PM

[!--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 profile.php page.

#4 austar

austar
  • Members
  • Pip
  • Newbie
  • 7 posts
  • LocationMT

Posted 14 March 2006 - 02:55 PM

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:


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

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

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;
}

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
Neo-Maxi-Zoom-Dweebie.

#5 Immortal55

Immortal55
  • Members
  • PipPipPip
  • Advanced Member
  • 59 posts

Posted 14 March 2006 - 10:05 PM

Alright, well if I was to do this, would it be possible for somebody to view the members page, even when not logged on? If they could view the persons page, how would it be possible for the profile.php page to load certain users information?

#6 Immortal55

Immortal55
  • Members
  • PipPipPip
  • Advanced Member
  • 59 posts

Posted 14 March 2006 - 11:43 PM


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:

<?

$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>';
    
}

?>

if anything is wrong, please help me out.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users