I am trying to make a list of members on my site, but none of the names show up on the page when I run the code. Here's the code:
<?php
session_start();
if (!$_SESSION["valid_user"])
{
// User not logged in, redirect to login page
Header("Location: index.php");
}
?>
<html>
<head>
<title> Lego Comic </title>
<link rel="stylesheet" type="text/css" href="style.css" />
<style type="text/css">
#Menu ul
{
list-style-type:none;
margin-left: 100px;
margin-right: 100px;
padding:0;
overflow:hidden;
}
#Menu li
{
float:left;
}
#Menu a:link, #Menu a:visited
{
display:block;
width:204px;
font-weight:bold;
color:#FFFFFF;
background-color:#06799f;
text-align:center;
padding:4px;
text-decoration:none;
text-transform:uppercase;
border-width: medium
border-style: ridge
border-color: red
}
#Menu a:hover,a:active
{
background-color: red;
}
#Members ul
{
list-style-type:none;
}
</style>
</head>
<body>
<center>
<?php
include "dbconfig.php";
?>
<div id="Menu">
<ul>
<li><a href="mainsite.php" title="Home">Home</a></li>
<li><a href="currentcomic.php" title="Current Comic">Current Comic</a></li>
<li><a href="othercomics.php" title="Other Comics">Other Comics</a></li>
<li><a href="games.php" title="Games">Games</a></li>
<li><a href="members.php" title="Members">Members</a></li>
</ul>
</div>
<h1> Lego Comic </h1>
<h2> List of Members </h2>
<div id="Members">
<ul>
<?php
// SQL query
$strSQL = "SELECT * FROM Members ORDER BY 'username' DESC";
// Execute the query (the recordset $rs contains the result)
$rs = mysql_query($strSQL);
// Loop the recordset $rs
while($row = mysql_fetch_array($rs)) {
// Name of the person
$strName = $row['username'];
// Create a link to person.php with the id-value in the URL
$strLink = "<a href = 'person.php?id = " . $row['id'] . "'>" . $strNavn . "</a>";
// List link
echo "<li>" . $strLink . "</li>";
}
?>
</ul>
</div>
<?php
// Display logout link
echo "<p> This page was last edited: " . date("r", filemtime("members.php"));
//This shows when the page was last edited
?>
<p><a href="logout.php" title="Logout">Click Here To Logout!</a></p>
</center>
</body>
</html>
Any ideas? Also, I am following a tutorial, but cannot make sense of "$strNavn", which it told me to write. What is it?