Hi,
Right now I am in the process of making a simple "members area" php/mysql script, and for the most part it is working.... I am only having one problem; one of the parts of the script is that when someone logs in, it should say "Welcome person'snamehere", however I am getting the resource ID #5 error....
Here is my code thus far:
<?php
include 'db.php';
//checks cookies to make sure they are logged in
if(isset($_COOKIE['ID_mrtg']))
{
$username = $_COOKIE['username'];
$password = $_COOKIE['password'];
$check = mysql_query("SELECT * FROM users WHERE username = '$username'")or die(mysql_error());
$name = mysql_query("SELECT `name` FROM users WHERE username = '$username'")or die(mysql_error());
while($info = mysql_fetch_array( $check ))
{
//if the cookie has the wrong password, they are taken to the login page
if ($password != $info['password'])
{ header("Location: login.php");
}
//otherwise they are shown the admin area
else
{
echo "Admin Area<p>";
echo $name;
echo "Your Content<p>";
echo "<a href=logout.php>Logout</a>";
}
}
}
else
Given, this isn't all of the code for that page, but it should contain all of the code relating to the error I believe.
Any help would be greatly appreciated!
Thanks
-steve