Malte: Kleinen Fehler im Loginscript

Beitrag lesen

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '== Malte AND password == kroatien' at line 1

und mein Code:

  
<?php  
session_start ();  
error_reporting(E_ALL);  
include ("../verbindung.php");  
  
$username = addslashes(htmlspecialchars($_POST['username']));  
$password = addslashes(htmlspecialchars($_POST['password']));  
  
$sql ="SELECT id, username, password FROM user WHERE username == ".$username." AND password == ".$password."";  
  
$result = mysql_query ($sql) or die(mysql_error()); ;  
  
if (mysql_num_rows ($result) > 0)  
{  
  $data = mysql_fetch_array ($result);  
  
  $_SESSION["user_id"] = $data["id"];  
  $_SESSION["user_username"] = $data["username"];  
  $_SESSION["user_password"] = $data["password"];  
  
  echo "<meta http-equiv=\"refresh\" content=\"0; ../../forum.php\">";  
  
}  
else  
{  
echo "<meta http-equiv=\"refresh\" content=\"15; ../../forum.php?fehler=1\">";  
}  
?>