Resource as conditional
Posted: Sat Sep 20, 2008 12:03 am
Hi. I'm writing a registration / email validation script. The registration form generates the validation string and stores it in the MySQL table in the user's tuple. The part that's giving me issues is the validation page. The user follows an email link to a page that asks for his email and validation code. It's supposed to check that the pair entered matches the tuple and if so update the "validated" column to "YES", but it doesn't work. I think in might have to do with my not accessing the resource properly, but try looking up "accessing php resource" on the web.
Hahaha. It always goes to the else. Any ideas?
Hahaha.
Code: Select all
/***Check input & update table or give error***/
$query = "select val_string from $table_name where email = \"$_POST[email]\"";
$result = mysql_query($query);
if ($result->val_string == $_POST['val_string']) {
$update_user = "update $table_name set validated = \"YES\" where email = $_POST[email] && val_string = $_POST[val_string]";
mysql_query($update_user);
echo "Success! Feel free to login.";
} else {
echo "Sorry, please try again.";
}