I would like the result of my query to appear in the form of a table. Could you please tell me what is wrong with my code? Please find my code below. Thank you.
The result appears like this now:
User ID: 6
First Name: James
Username: Obed
Logged in: 08/26/2004
email: obed@aol.com
Click here to logout!
I would like it to appear as shown below:
Here are your details...
User ID First Name Username Logged in email
6 James Obed 08/26/2004 obed@aol.com
Click here to logout!
<?php
session_start();
if (!$_SESSION["valid_user"])
{
// User not logged in, redirect to login page
Header("Location: login.php");
}
// Display Member-only stuff
// ...
// ...
// ...
// Display Member information
echo "<p>User ID: " . $SESSION["valid_id"];
echo "<p>First Name: " . $SESSION["valid_fname"];
echo "<p>Username: " . $SESSION["valid_user"];
echo "<p>Logged in: " . date("m/d/Y", $SESSION["valid_time"]);
echo "<p>email: " . $_SESSION["valid_email"];
// my table code: I want to use the code below to make the info above appear as a table.
$list = "<table border=\"1\" cellpadding=\"2\">";
$list.="<tr><th>User ID</th>";
$list.="<th>First Name</th>";
$list.="<th>Username</th>";
$list.="<th>Logged in</th>";
$list.="<th>email</th></tr>";
while ($row= mysql_fetch_array ($rs) )
{
$list .= "<tr>";
$list .= "<td>".$row. $_SESSION["valid_id"] ."</td>";
$list .= "<td>".$row["valid_fname"] ."</td>";
$list .= "<td>".$row["valid_user"] ."</td>";
$list .= "<td>".$row["valid-time"] ."</td>";
$list .= "<td>".$row["valid-email"] ."</td>";
$list .= "</tr>";
}
$list .= "</table>";
echo ("Here are your details...");
echo($list);
// end my table code
// Display logout link
echo "<p><a href=\"logout.php\">Click here to logout!</a></p>";
?>