How to Create Profile Information Page in PHP/MySQL

Submitted by: 
Language: 
Visitors have accessed this post 145098 times.

Good day everyone, I am going to create my new tutorial called "Simple Profile Information Page". In this tutorial you can integrate my previous code on How to Create Registration Page in PHP/MySQL and on How to Create Login Page in PHP/MySQL.

To start with, follow the steps below.

Create a Registration Page

First, follow the instruction on How to Create Registration Page in PHP/MySQL.

Create a Login Page

Next, create login page by the following the tutorial on How to Create Login Page in PHP/MySQL.

Creating a Profile Page

After following the procedure above, create a file and save it as home.php. This code will display the profile of the member after registration. To create a form, open your favorite HTML code editor and paste the code below after the body tag.

  1. <?php
  2. require_once('connection.php');
  3. $id=$_SESSION['SESS_MEMBER_ID'];
  4. $result3 = mysql_query("SELECT * FROM member where mem_id='$id'");
  5. while($row3 = mysql_fetch_array($result3))
  6. {
  7. $fname=$row3['fname'];
  8. $lname=$row3['lname'];
  9. $address=$row3['address'];
  10. $contact=$row3['contact'];
  11. $picture=$row3['picture'];
  12. $gender=$row3['gender'];
  13. }
  14. ?>
  15. <table width="398" border="0" align="center" cellpadding="0">
  16. <tr>
  17. <td height="26" colspan="2">Your Profile Information </td>
  18. <td><div align="right"><a href="index.php">logout</a></div></td>
  19. </tr>
  20. <tr>
  21. <td width="129" rowspan="5"><img src="<?php echo $picture ?>" width="129" height="129" alt="no image found"/></td>
  22. <td width="82" valign="top"><div align="left">FirstName:</div></td>
  23. <td width="165" valign="top"><?php echo $fname ?></td>
  24. </tr>
  25. <tr>
  26. <td valign="top"><div align="left">LastName:</div></td>
  27. <td valign="top"><?php echo $lname ?></td>
  28. </tr>
  29. <tr>
  30. <td valign="top"><div align="left">Gender:</div></td>
  31. <td valign="top"><?php echo $gender ?></td>
  32. </tr>
  33. <tr>
  34. <td valign="top"><div align="left">Address:</div></td>
  35. <td valign="top"><?php echo $address ?></td>
  36. </tr>
  37. <tr>
  38. <td valign="top"><div align="left">Contact No.: </div></td>
  39. <td valign="top"><?php echo $contact ?></td>
  40. </tr>
  41. </table>
  42. <p align="center"><a href="index.php"></a></p>

That’s it! You’ve been successfully created your simple profile page with registration and login, see you in my next tutorial.


Comments

i am Checkvil. This i my login on this forum. it is good ? :)

i am Checkvil. This i my login on this forum. it is good ? :)

i am Checkvil. This i my login on this forum. it is good ? :)

i am Checkvil. This i my login on this forum. it is good ? :)

It is english language possible to write? Sorry for my proor eng

I am from Slovenia. I can help with build this forum. Thanks for approved.

Jaz sem Slovenka. Lahko pomagam pri razvoju foruma.

Help. I am looking for guide

i am new user for you. thanks

I found this site and hmm i cant use shoutbox. It is possible?

hello i am new user thanks for approved :)

Hi :-). I am Wrateeeesa.

I am new on this site.

Hello everyone. I would to present my personal objective suggest about this website. It is good category? warteesy. Regards

Please this code is not fetching data in my profile.php.
Can any one help?

<?php
require_once('connection.php');
$id=$_SESSION['SESS_MEMBER_ID'];
$result3 = mysql_query("SELECT * FROM member where mem_id='$id'");
while($row3 = mysql_fetch_array($result3))
{
$fname=$row3['fname'];
$lname=$row3['lname'];
$address=$row3['address'];
$contact=$row3['contact'];
$picture=$row3['picture'];
$gender=$row3['gender'];
}
?>

Your Profile Information logout
" width="129" height="129" alt="no image found"/> FirstName: <?php echo $fname ?>
LastName: <?php echo $lname ?>
Gender: <?php echo $gender ?>
Address: <?php echo $address ?>
Contact No.: <?php echo $contact ?>

Why i can't download it

hi i am getting error in my code
Warning: mysql_error(): supplied resource is not a valid MySQL-Link resource in C:\wamp\www\gurumaya\user\newuser\profile.php on line 138 and 139
my code is:

133: include('reg_config.php');
134: $id=$_SESSION['SESS_MEMBER_ID'];
135: // Get page data
136: $query = 'SELECT * FROM userlog where `id`=1;';
137: //$query= mysql_query("SELECT * FROM `userlog` WHERE id = '".$_SESSION['SESS_MEMBER_ID']."' ");

138: $result=mysql_query($query);
139: $num=mysql_num_rows($result);
140: $i=0;
141: while ($i < $num) {

$id=mysql_result($result,$i,"id");
$fname=mysql_result($result,$i,"fname");
$lname=mysql_result($result,$i,"lname");
$mobile=mysql_result($result,$i,"mobile");
$email=mysql_result($result,$i,"email");
$address= mysql_result($result,$i,"address");
$i++;
}

Hi is it possible to make these fields editable
example user during signup entered wrong telephone number and wants to change it.

thanks tht helped a lot.. but cud you please tell me how to get an image displayed there. please make it more clear...thnkz in advance

Could you kindly update your scripto mysqli?

  1. <?php
  2. $local_host = 'localhost'; //host doman.com
  3. $db_host = $local_host;
  4.  
  5. $db_user = 'root'; // database username
  6. $user = $db_user;
  7.  
  8. $db_pass = ''; //db password
  9. $pass = $db_pass;
  10.  
  11. $db_name = 'member'; //
  12. $db = $db_name;
  13.  
  14. // connect to mysql
  15. $sql_con = mysql_connect("$db_host","$db_user","");
  16. $sql_db = mysql_select_db("$db") ;
  17.  
  18. $sql = "SELECT * FROM user";
  19. $query = mysql_query($sql);
  20.  
  21. while($row = mysql_fetch_array($query)){
  22.  
  23. $username = $row['username'];
  24. $time = $row ['time'];
  25.  
  26.  
  27. //make a user link when you click in any user this link well open his profile
  28. echo '<div style="font-size:18px; color:blue; margin-top:-5px;" ><a href="profile.php?'.$_COOKIE['user'].'">'.$username.'</a></div>';
  29.  
  30. //$n = $_REQUEST[$time];
  31. //setcookie('user','manassa');
  32. }
  33.  
  34.  
  35. ?>

after that make new file as profile.php

profile.php

  1. <?php
  2.  
  3.  
  4. if($_REQUEST['user'] == $_COOKIE['user'] || $_COOKIE['user'] == 'Admin'){
  5.  
  6. echo'<form action="settings.php">
  7. <input id="button" type="submit" value="Settings V"/>
  8. <input id="button" type="submit" value="massege"/>
  9. </form>';
  10. }
  11. elseif($_REQUEST['user'] == 'user'){
  12. //header("location:profile.php");
  13. }
  14. else
  15. {
  16. echo'<form action="follow.php">
  17. <input id="button" type="submit" value="follow +"/>
  18. <input id="button" type="submit" value="massege"/>
  19. </form>';
  20. }
  21. }
  22.  
  23. ?>
  24.  
  25. </div>
  26. </div>
  27.  
  28.  
  29.  
  30.  
  31.  
  32. <?php
  33.  
  34.  
  35. //$man = $_GET[$username]
  36. if(isset($_REQUEST['user'])){
  37. echo $_REQUEST['user']."Profile"; //code here
  38.  
  39. // class information ()/{ // this function To Get profile Information!
  40. $user = $_REQUEST['user'];
  41. $sql = "SELECT * FROM user WHERE username='$user'" ;
  42. $query = mysql_query($sql);
  43. while($rows = mysql_fetch_array($query))
  44. {
  45.  
  46. $username = $rows ['username'];
  47. /* $Email = $rows ['Email'];
  48.   $pass = $rows ['time'];
  49.   $quetion = $rows ['quetions'];
  50.   $answer = $rows ['answer']; */
  51.  
  52.  
  53.  
  54. /*echo "<br/>".$username;
  55.   echo "<br/>".$Email;
  56.   echo "<br/>".$pass;
  57.   echo "<br/>".$quetion;
  58.   echo "<br/>".$answer;
  59.   */
  60.  
  61.  
  62.  
  63.  
  64.  
  65. }
  66.  
  67. }
  68.  
  69.  
  70. else
  71. {
  72. header("location:profile.php?user=".$_COOKIE['user']);
  73. }
  74.  
  75.  
  76.  
  77.  
  78. ?>

Notice: Undefined variable: _SESSION in C:\xampp\htdocs\home.php on line 5
Your Profile Information
logout
no image found
FirstName:

Notice: Undefined variable: fname in C:\xampp\htdocs\home.php on line 25
LastName:

Notice: Undefined variable: lname in C:\xampp\htdocs\home.php on line 29
Gender:

Notice: Undefined variable: gender in C:\xampp\htdocs\home.php on line 33
Address:

Notice: Undefined variable: address in C:\xampp\htdocs\home.php on line 37
Contact No.:

Notice: Undefined variable: contact in C:\xampp\htdocs\home.php on line 41

am getting the following error message

Undefined variable: _SESSION in C:\wamp\www\Registration\home.php on line 3

Undefined variable: picture in C:\wamp\www\Registration\home.php on line 21

SCREAM: Error suppression ignored for
( ! ) Notice: Undefined variable: fname in
C:\wamp\www\Registration\home.php on line 23

( ! ) SCREAM: Error suppression ignored for
( ! ) Notice: Undefined variable: lname in C:\wamp\www\Registration\home.php on line 27

can anyone help please

hello ur problem soloution is

<?php
require_once('auth.php');
require_once('connection.php');
$id=$_SESSION['SESS_MEMBER_ID'];
$result3 = mysql_query("SELECT * FROM member where mem_id='$id'");
while($row3 = mysql_fetch_array($result3))
{
$fname=$row3['fname'];
$lname=$row3['lname'];
$address=$row3['address'];
$contact=$row3['contact'];
$picture=$row3['picture'];
$gender=$row3['gender'];
}
?>

plzzz suggest me about picture upload in registration form, and showing in home page or profile page.

Am getting the followings erros
Notice: Undefined variable: _SESSION in C:\wamp\www\my_school_management system\home.php on line 54
pls i need your help....

Working fine ! But I'm working on a web app and I'm looking for a way for a user to log Out and, I'm looking too for a way to redirect peoples arriving on index.php without logged in at login.php is there a way ?
Thanks

PLEASE HELP! I'M GETTING THIS ERROR

Deprecated: Assigning the return value of new by reference is deprecated in C:\xampp\php\pear\Auth.php on line 469

Notice: Undefined variable: _SESSION in C:\xampp\htdocs\wew\registration\home.php on line 4

am getting the following error message

Undefined variable: _SESSION in C:\wamp\www\Registration\home.php on line 3

Undefined variable: picture in C:\wamp\www\Registration\home.php on line 21

SCREAM: Error suppression ignored for
( ! ) Notice: Undefined variable: fname in
C:\wamp\www\Registration\home.php on line 23

( ! ) SCREAM: Error suppression ignored for
( ! ) Notice: Undefined variable: lname in C:\wamp\www\Registration\home.php on line 27

can anyone help please

Hi! =) kindly next time put some complete download source sir/ma'am for this tutorial even if it's only a short code. but this is great! I lav it ^_^

Thnku sooo much for this code.....after getting this code. i solved my problem after 10 days.. soo again thnks

add this on top of home.php:
<?php require_once('auth.php');?>

Hai i want new tutorial script php mysql

why take so long for the login to login user in

it doesn't display the other the name etc..

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • You may insert videos with [video:URL]
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd> <table> <tr> <td> <th> <img> <h1> <h2> <h3> <iframe> [video]
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <asp>, <c>, <cpp>, <csharp>, <css>, <html4strict>, <java>, <javascript>, <mysql>, <php>, <python>, <sql>, <vb>, <vbnet>. The supported tag styles are: <foo>, [foo].
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.