I have tried numerous combinations of code to try and display my client data to them on their own profile page once they log in.
This is my first time designing a website and i have never worked with MySQL before but i have developed a quick understanding of how it all works.
I understand that i need to create sessions to 'store' their information when they log in then i can display it as i wish ?
Does anyone have any code that i could use?
My SQL info:
- db: taxretur_login
- table: members
aspects i would like to show:
- name
- username
Thanks. Stan.
UPDATE:
This code works and pulls all my table info accross to a users page but i only want data unique to that paticular user:
<?php
$dbhost = 'localhost';
$dbuser = '';
$dbpass = '';
$conn = mysql_connect($dbhost, $dbuser, $dbpass);
if(! $conn )
{
die('Could not connect: ' . mysql_error());
}
$sql = 'SELECT id_user, email,
name, username
FROM members';
mysql_select_db('taxretur_login');
$retval = mysql_query( $sql, $conn );
if(! $retval )
{
die('Could not get data: ' . mysql_error());
}
while($row = mysql_fetch_assoc($retval))
{
echo "User ID :{$row['id_user']} <br> ".
"Email: {$row['email']} <br> ".
"Name: {$row['name']} <br> ".
"Username : {$row['username']} <br> ".
"--------------------------------<br>";
}
echo "Fetched data successfully
";
mysql_close($conn);
?>
See Question&Answers more detail:os