<?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>
Recommended Answers
Jump to PostI 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.
Jump to PostRe-post this with some more explanation for our understanding and use code tags to post your codes
Jump to PostTry 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'] . "'");
All 10 Replies
vibhaJ
126
Master Poster
karthik_ppts
81
Posting Pro
shyam2011
-1
Newbie Poster
shyam2011
-1
Newbie Poster
karthik_ppts
81
Posting Pro
shyam2011
-1
Newbie Poster
vibhaJ
126
Master Poster
karthik_ppts
81
Posting Pro
shyam2011
-1
Newbie Poster
vibhaJ
126
Master Poster
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.