Hab wohl ein Fehler in meiner SQL Abfrage -.-
Nur finde ich den Fehler nicht kann mir einer da helfen bitte?^^
Hier der Fehler:
------------------
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 'sha_pass_hash = "6812a9f52aedada87c915b2df0bgg11e927f6532"' at line 1
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in X:\xampp\htdocs\vote\login.php on line 29
Warning: Cannot modify header information - headers already sent by (output started at X:\xampp\htdocs\vote\login.php:26) in X:\xampp\htdocs\vote\login.php on line 41
----------------
Hier die PHP Datei
Nur finde ich den Fehler nicht kann mir einer da helfen bitte?^^
Hier der Fehler:
------------------
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 'sha_pass_hash = "6812a9f52aedada87c915b2df0bgg11e927f6532"' at line 1
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in X:\xampp\htdocs\vote\login.php on line 29
Warning: Cannot modify header information - headers already sent by (output started at X:\xampp\htdocs\vote\login.php:26) in X:\xampp\htdocs\vote\login.php on line 41
----------------
Hier die PHP Datei
PHP-Code:
<?php
error_reporting(E_ALL);
ini_set('display_errors', '1');
// Session starten
session_start ();
//Verbindungsdaten
$IP = "127.0.0.1";
$User = "root";
$Pass = "pass";
$DB = "logon";
$Table1 = "account";
$Table2 = "account_banned";
$connect = mysql_connect ($IP, $User, $Pass);
if (!mysql_select_db ($DB, $connect))
{
die ("Verbindung zur Datenbank nicht moeglich");
}
$hash = sha1 ($_REQUEST["name"] .":" .$_REQUEST["pwd"]);
$sql = "SELECT id, username, sha_pass_hash FROM" .$Table1 ."WHERE sha_pass_hash = \"" .$hash ."\"";
$result = mysql_query ($sql);
print 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_hash"] = $data["sha_pass_hash"];
header ("Location: vote.php");
}
else
{
header ("Location: loginf.php?fehler=1");
}
?>
Kommentar