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 '@gmail.com)' at line 1
Det er fejlen jeg får når jeg afprøver min kode i php. Jeg er i gang med at fikse det så den sender information ind i en tabel, uheldigvis vil den ikke, der går noget galt hver gang, men jeg er ikke sikker på hvad jeg skal gøre, her er koden.$host = "localhost";
$username = "root";
$password = "hda99zkk";
$database = "wishlist";
$table = "members";
MySQL_connect("$host", "$username", "$password") or die(mysql_error());
MySQL_select_db("$database") or die(mysql_error());
$user = $_REQUEST["username"];
$pass = $_REQUEST["password"];
$pass2 = $_REQUEST["passwordrepeat"];
$email = $_REQUEST["email"];
$email2 = $_REQUEST["emailrepeat"];
if ($pass <> $pass2){
echo "Sorry, but your account has not been created, you did not repeat your password correctly.";
}
if ($pass == $pass2){
if ($email <> $email2){
echo "Sorry, but your account has not been created, you did not repeat your email correctly.";
}
if ($email == $email2){
$sql = "INSERT INTO members (username, password, email) VALUES ($user, $pass, $email)";
$result = mysql_query($sql) or die (mysql_error());
if ($result == true){
echo "Your account has been created succesfully. <a href=index.php>Click here</a> to go back.";
}
if ($result == false){
echo "something went wrong, please try again.";
}
}
}
når jeg prøver at bruge koden så har jeg indtastet en email et password og et brugernavn. Men den kommer tilbage med fejl, igen hver gang. Hvis i kan hjælpe vil jeg blive taknemmelig.