Am designing the page where by the user is directed after loging in. am using php code to generate the profile of the user who is in session/logged in user. below is the code that i has come up with but its not working. the problem seems to be in the where clause. please help me modify it such that the code can select and output the user profile details when the user logs in the website
<?php
mysql_connect("localhost","root","") or
die("could not connect to database");
mysql_select_db("DELETED") or
die("could not select database");
session_start();
$username=$_SESSION;
//echo $name;


$date = gmdate("Y-m-d ");
echo $date;


$result=mysql_query("select title,first_name,last_name,email,username,address,country,city,mobile_phone FROM Customer_Infor WHERE username=$_SESSION ") or
die (mysql_error());
while($row=mysql_fetch_array($result))
{
echo"<b>profile:</b>";
echo"<br>\n";
echo"<b>title:</b>";
echo $row["title"];
echo"<br>\n";
echo"<b>first_name:</b>";
echo $row["first_name"];
echo"<br>\n";
echo"<b>last_name:</b>";
echo $row["last_name"];
echo"<br>\n";
echo"<b>email:</b>";
echo $row["email"];
echo"<br>\n";
echo"<b>username:</b>";
echo $row["username"];
echo"<br>\n";
echo"<b>address:</b>";
echo $row["address"];
echo"<br>\n";
echo"<b> country:</b>";
echo $row["country"];
echo"<br>\n";
echo"<b>city:</b>";
echo $row["city"];
echo"<br>\n";
echo"<b>phone:</b>";
echo $row["mobile_phone"];
echo"<br>\n";
echo"<br>\n";
echo"<br>\n";
echo"<br>\n";
echo"<br>\n";
}
?>

Try this:

$result = mysql_query("select title,first_name,last_name,email,username,address,country,city,mobile_phone FROM Customer_Infor WHERE username='{$_SESSION['username']}' ") or die (mysql_error());
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.