This is my login code: <?php if ($_POST['accountemail']) { //did they supply a password and username $email=mysql_real_escape_string($_POST['accountemail']); $password=mysql_real_escape_string($_POST['accountpassword']); if ($password==NULL) { echo "A password was not supplied"; }else{ $query = mysql_query("SELECT email,password FROM accounts WHERE email='$email'") or die(mysql_error()); $data = mysql_fetch_array($query); if($data['password'] != $password) { include('../loginerror.php'); }else{ $query = mysql_query("SELECT email,password,username FROM accounts WHERE email='$email'") or die(mysql_error()); $row = mysql_fetch_array($query); $_SESSION["account"] = $row['username']; echo "<meta http-equiv=Refresh content=1;url=members.php>"; } } } ?> PHP: But its giving me the error: Whats wrong with it? I know its connecting to the database because i have other code requesting information from the database. I also am using the same code on another website on the same server and it works, so i have no idea whats wrong.
you didn't connect to your database .... put these two line ( u need to modify your variable) mysql_connect($hostname,$dbusername,$dbpassword) or die("Could not connect to DataBase"); mysql_select_db($dbname) or die("Could not find DB");