<?php

// Inialize session
session_start();
include('config.inc');
// Check, if username session is NOT set then this page will jump to login page
if (!isset($_SESSION['username'])) {
        header('Location: index.php');
}
?>
<html>

<head>
  <title>Secured Page</title>
</head>

<body>

<?php 
$result = mysql_query("SELECT user.password, data1.dob FROM user INNER JOIN data1 ON user.username = data1.username WHERE username = '" . $_SESSION['username'] . "'");

  echo "<table border='1'>
  <tr>
  <th>Name</th>
  <th>Message</th>
  </tr>";
  while ($row = mysql_fetch_array($result)) {
  echo "<tr>";
  echo "<td>" . $row['password'] . "</td>";
  echo "<td>" . $row['dob'] . "</td>";
  echo "</tr>";
  }
  echo "</table>";

?>
<p><a href="logout.php">Logout</a></p>

</body>

</html>
nonshatter commented: Unclear post. What is your actual problem.,= -1

I know its your first post, but at least should have sense how would people know your problem without describing.
And yeah have practice with code tag to post code.

Re-post this with some more explanation for our understanding and use code tags to post your codes

<?php

// Inialize session
session_start();
include('config.inc');
// Check, if username session is NOT set then this page will jump to login page
if (!isset($_SESSION['username'])) {
header('Location: index.php');
}
?>
<html>

<head>
<title>Secured Page</title>
</head>

<body>

<?php
$result = mysql_query("SELECT user.password, data1.dob FROM user INNER JOIN data1 ON user.username = data1.username WHERE username = '" . $_SESSION['username'] . "'");

echo "<table border='1'>
<tr>
<th>Name</th>
<th>Message</th>
</tr>";
while ($row = mysql_fetch_array($result)) {
echo "<tr>";
echo "<td>" . $row['password'] . "</td>";
echo "<td>" . $row['dob'] . "</td>";
echo "</tr>";
}
echo "</table>";

?>
<p><a href="logout.php">Logout</a></p>

</body>

</html>

I have two MySQL table table "user" & "data1" i want to display data from both table,
user name is conman both table. if user one login then it should be display data for user one..........thanks in advance. please help me

I have two MySQL table table "user" & "data1" i want to display data from both table,
user name is conman both table. if user one login then it should be display data for user one..........thanks in advance. please help me

Now what is your output with this code?

This is the out put sir

Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\login\securedpage.php on line 27

Try user.username in where condition.

$result = mysql_query("SELECT user.password, data1.dob FROM user INNER JOIN data1 ON user.username = data1.username WHERE user.username = '" . $_SESSION['username'] . "'");

try with vibhadevit's suggestion and see what happens.

Thanks sir,
my prob. is solved ......!
thanks to daniweb, vibhadevit sir, & Karthik_pranas.

Thanks a lot.

Hey m not sir.. m mam :)

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.