Immortal55 Posted March 14, 2006 Share Posted March 14, 2006 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? Quote Link to comment Share on other sites More sharing options...
trq Posted March 14, 2006 Share Posted March 14, 2006 [!--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. Quote Link to comment Share on other sites More sharing options...
trq Posted March 14, 2006 Share Posted March 14, 2006 [!--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. Quote Link to comment Share on other sites More sharing options...
austar Posted March 14, 2006 Share Posted March 14, 2006 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_namestripslashes(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 Quote Link to comment Share on other sites More sharing options...
Immortal55 Posted March 14, 2006 Author Share Posted March 14, 2006 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? Quote Link to comment Share on other sites More sharing options...
Immortal55 Posted March 14, 2006 Author Share Posted March 14, 2006 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.