[Kurze Hilfe] SQL/PHP-Fehler

Tix

Erfahrenes Mitglied
Kann mir mal kurz einer auf die Sprünge helfen. Ich stehe gerade irgendwie aufm Schlauch. Hier mein Quelltext:

Code:
<?php
 // Session starten
 session_start ();
 
 include('../sql_config.php');
 
 $sql = "SELECT ".
 	"user_id, user_nick, user_email, user_sec_email, user_vorname, user_nachname, user_sex, user_bd_day, user_bd_month, user_bd_year, user_origin, user_icq, user_aim, user_yim, user_signatur, user_hobby, user_regdate, user_lastlogin, user_status, user_avatar, user_post, game_finance, game_kreuzer, game_ritter, game_schloesser, game_burgen, build_start, build_end, update_start, update_end".
   "FROM ".
 	"tr_user ".
   "WHERE ".
 	"(user_nick like '".$_REQUEST["nick"]."') AND ".
 	"(user_password = '".md5 ($_REQUEST["pw"])."')";
 	
 $result = mysql_query ($sql);
 
 if (mysql_num_rows ($result) > 0)
 {
   // Benutzerdaten in ein Array auslesen.
   $data = mysql_fetch_array ($result);
 
   // Sessionvariablen erstellen und registrieren
   $_SESSION["id"] = $data["user_id"];
   $_SESSION["nick"] = $data["user_nick"];
   $_SESSION["email"] = $data["user_email"];
   $_SESSION["sec_email"] = $data["user_sec_email"];
   $_SESSION["vorname"] = $data["user_vorname"];
   $_SESSION["nachname"] = $data["user_nachname"];
   $_SESSION["sex"] = $data["user_sex"];
   $_SESSION["bd_day"] = $data["user_bd_day"];
   $_SESSION["bd_month"] = $data["user_bd_month"];
   $_SESSION["bd_year"] = $data["user_bd_year"];
   $_SESSION["origin"] = $data["user_origin"];
   $_SESSION["icq"] = $data["user_icq"];
   $_SESSION["aim"] = $data["user_aim"];
   $_SESSION["yim"] = $data["user_yim"];
   $_SESSION["signatur"] = $data["user_signatur"];
   $_SESSION["hobby"] = $data["user_hobby"];
   $_SESSION["reg_date"] = $data["user_reg_date"];
   $_SESSION["lastlogin"] = $data["user_lastlogin"];
   $_SESSION["status"] = $data["user_status"];
   $_SESSION["avatar"] = $data["user_avatar"];
   $_SESSION["post"] = $data["user_post"];
   $_SESSION["game_finance"] = $data["game_finance"];
   $_SESSION["game_kreuzer"] = $data["game_kreuzer"];
   $_SESSION["game_ritter"] = $data["game_ritter"];
   $_SESSION["game_schloesser"] = $data["game_schloesser"];
   $_SESSION["game_burgen"] = $data["game_burgen"];
   $_SESSION["build_start"] = $data["build_start"];
   $_SESSION["build_end"] = $data["build_end"];
   $_SESSION["update_start"] = $data["update_start"];
   $_SESSION["update_end"] = $data["update_end"]; 
 
   header ("Location: ../index_intern.php");
 }
 else
 {
   header ("Location: formular.php?fehler=1");
 }
 ?>

Hier meine Fehlermeldung


Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/www/kmm611/html/florian-bloemker/login/login.php on line 17

Warning: Cannot modify header information - headers already sent by (output started at /home/www/kmm611/html/florian-bloemker/login/login.php:17) in /home/www/kmm611/html/florian-bloemker/login/login.php on line 58


Wäre echt nett wenn Ihr mir kurz mal den Fehler zeigt, irgendwie bin ich gerade blind
 
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 'WHERE (user_nick like 'Tix') AND (user_password = 'zensiert
 
Mach mal folgendes:
PHP:
$sql = "SELECT
 	user_id, user_nick, user_email, user_sec_email, user_vorname, user_nachname, user_sex, user_bd_day, user_bd_month, user_bd_year, user_origin, user_icq, user_aim, user_yim, user_signatur, user_hobby, user_regdate, user_lastlogin, user_status, user_avatar, user_post, game_finance, game_kreuzer, game_ritter, game_schloesser, game_burgen, build_start, build_end, update_start, update_end
   FROM 
 	tr_user 
   WHERE
 	(user_nick like '".$_REQUEST[nick]."') AND
 	(user_password = '".md5 ($_REQUEST[pw])."')";
 
Dann weiß du schonmal, woran es liegt.
Probier mal:
PHP:
$sql = "SELECT ".
 	"user_id, user_nick, user_email, user_sec_email, user_vorname, user_nachname, user_sex, user_bd_day, user_bd_month, user_bd_year, user_origin, user_icq, user_aim, user_yim, user_signatur, user_hobby, user_regdate, user_lastlogin, user_status, user_avatar, user_post, game_finance, game_kreuzer, game_ritter, game_schloesser, game_burgen, build_start, build_end, update_start, update_end ".
   "FROM ".
 	"tr_user ".
   "WHERE ".
 	"user_nick = '".$_REQUEST["nick"]."' AND ".
 	"user_password = '".md5 ($_REQUEST["pw"])."'";
 
Hach Leute,

Ihr seit echt die besten, kann man nicht anders sagen.

PS: Das Script von moritz läuft, danke Ihr zwei nochmal.
 
Zurück