Hi-
I have this working with just one value; either the screen name or the password, but not both. Can anyone help?
// create SQL statement
$sql = "SELECT name, password FROM users
WHERE name='$screen_name' AND password='$password';";
// execute SQL query and get result
$sql_result = mysql_query($sql,$connection) or die("Couldn't execute query");
$data = mysql_fetch_array($sql_result);
// this if statement isn't working with the 2 values, but works just fine with one
if (($data['name'] != $screen_name) && ($data['password'] != $password)){
// if the name and password didn't work, set login = 0
$login = 0;
//set the cookie and return to login page
With that if statement as is, it sets a cookie and just returns me to my homepage (where i tell it to go if i'm logged in), but I'm not logged in because a value on my homepage doens't change like its supposed to.
Thanks =)