I haven't used php/mysql in a while, so I'm having a total brain cramp.
I've got a login session script running which works fine. If you're logged in, you can go to you.php and fill out the information there. I'm trying to make an If statement that will check the specific table for a row that already has the session's username in it, and echo a "already did it" if it's there. Does that make sense?
I fixed the problem I had before (a print just returning the word "Array") but now I have another problem.
Here's the part of the code that's not working.
(snip...including session)
(snip...connect to database)
$bob = $session->username;
$sql="SELECT * FROM usertable WHERE username='$bob'";
$result = mysql_query($sql);
while ($row = mysql_fetch_assoc($result))
{
if ($row['username'] != $bob)
{
// Here is the form for filling out
} else {
echo "An entry with this username already exists.";
}
}
I want to say, if it returns true that there's a usrename with the same as the login to say "did it", otherwise show the form.
Instead, it works fine if the username already exists, but if it doesn't exist, it just gives me a blank page instead of the form or echo or whatever I put in there.
Does that make any sense at all?