I can't get that code to work properly. I'm quite confused about this. 
The following code:
Code:
if(@mysql_query("INSERT INTO Persons (id, username, password)
VALUES ('', '$user', '$pass')") && $_SESSION['done'])
{
$_SESSION['done'] == true;
}
To me means: if the MySQL query AND the $_SESSION['done'] variable are equal to TRUE, then $_SESSION['done'] is compared with true.
I'm not sure whether that was a typo but I think it probably is. I changed the comparison operator to the assign operator but it still didn't work.
It's the session variables that are confusing me in all this. There is $_SESSION['done'] being used as a parameter in the if statement, but there is no previous declaration for it. I come from programming in C so that doesn't make sense to me. Does this also count as a variable declaration?
I tried to make a declaration for it anyway but it still didn't work.
From my understanding the $_SESSION variables are stored on the server?
So if it does also count as a declaration, the following code SHOULD work:
Code:
if($_SESSION['done']) /* if true */
{
@mysql_query("INSERT INTO Persons (id, username, password)
VALUES ('', '$user', '$pass')")
$_SESSION['done'] = false;
}
If $_SESSION['done'] == true; execute the query and set $_SESSION['done'] to false. Then, next time it performs the check, the parameters won't be right and it won't be executed again.
But that doesn't work either. So what am I actually doing wrong? I know that if the parameter $_SESSION['done'] DOES count as a declaration, then every time the page is refreshed it's just gonna get set back to true, so obviously that method won't work.
How can I make sure it doesn't get set back to true each time the page is refreshed?
I've lost myself
Please help me with this session variable stuff 
Thanks for reading!
Bookmarks