Forum Moderators: open
I have a query that looks like this:
$result = @mysql_query("SELECT count(id) FROM members WHERE pass='$_POST[pass]' AND name='$_POST[user]' AND activated='1' AND expired > curdate()")
or die("Couldn't query the user-database.");
Later on in the script I have this:
if ($activated == "1") {
echo ("You will be redirected to your appropriate section in 3 seconds.")
Works like a charm as my login. Now I wanted to add if activated='2' the person will be directed to the same page. I think I have to change the first line of code to...
$result = @mysql_query("SELECT count(id) FROM members WHERE pass='$_POST[pass]' AND name='$_POST[user]' AND activated='1' OR activated='2' AND expired > curdate()")
or die("Couldn't query the user-database.");
Is this the correct syntax to use? Guess I should also LIMIT it to 1 since there should only be one row pulled.
Now I have tried to add "2" to the "if/echo" statement in various ways, but I always get some kind of error. How do I rewrite this statement to include an activation value of either "1" or "2"?
if ($activated == "1") {
echo ("You will be redirected to your appropriate section in 3 seconds.")
What is the correct way to write both lines of code?
*Wasn't sure if I should post this in the "Database" or the "PHP" section.