$query1 = "SELECT tblpatient_pass.RelationMR_no, tblpatient_pass.username, tblpatient_pass.password, tblpatient_pass.email_address, tblpatient_info.lastname, tblpatient_info.firstname, tblpatient_info.mname
FROM tblpatient_pass INNER JOIN tblpatient_info ON tblpatient_pass.RelationMR_no=tblpatient_info.MR_no
";
$numrows = mysql_num_rows($query1);
if ($numrows!=0)
{
while ($row = mysql_fetch_array($query1))
{
$username = $_SESSION['username'];
$query = mysql_query("SELECT * FROM tblpatient_pass WHERE username =".$username);
$result = mysql_query($query) or die(mysql_error());
while ($patient = mysql_fetch_array($result))
{
echo $patient['RelationMR_no'].'<br>';
echo $patient['username'].'<br>';
echo $patient['password'].'<br>';
echo $patient['email_address'].'<br>';
echo $patient['lastname'].'<br>';
echo $patient['firstname'].'<br>';
echo $patient['mname'].'<br>';
echo $patient['gender'].'<br>';
echo $patient['age'].'<br>';
}
}
}
guys can anybody help me,, my original problem is how I can make a profile page wherein it will display records from two different tables connected by MR_no as primary key from tblpatient_info and RelationMR_no from tblpatient_pass but I don't know how to display these records based on the username of the member. Because I quite not familiar with queries and specially inner join functions, I need to finish these for my project before March 10