Katzenbauer
Erfahrenes Mitglied
Ich bekomme bei diesem Scriptauszug einen mysql Syntax Error. Ich finde ihn nur nicht. Kann mir da jemand behilflich sein:
Genauer Error:
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 '' at line 1
PHP:
$num = 0;
while ($num>0) {
$k_laend = rand(1,100);
$k_graf = rand(1,100);
$k_burg = rand(1,10);
$query = mysql_query(" SELECT `k_laend`, `k_graf`, `k_burg` FROM `bg_burgen` WHERE `k_laend`='".$k_laend."' AND `k_graf`='".$k_graf."' AND `k_burg`='".$k_burg."'") or die(mysql_error());
$num = mysql_num_rows($query);
}
$query = mysql_query(" SELECT `userid` FROM `bb1_users` WHERE `username`='".addslashes($r_username)."'") or die(mysql_error());
$row = mysql_fetch_array($query);
$query = mysql_query(" INSERT INTO `bg_burgen`(`userid`, `k_laend`, `k_graf`, `k_burg`) VALUES ('".$row['userid']."', '".$k_laend."', '".$k_graf."', '".$k_burg."'") or die (mysql_error());
Genauer Error:
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 '' at line 1