i got an error running this SQL with PHP, but if i run it on the database itself it works without any error (im still quite new to mysql, so please give me a hint whats wrong, i can not find the problem).
The Query (also only line of code if $SQLDatei):
INSERT INTO BankUser (ID, Name, Admin, Password, AccessLevel, LoggedIn, FailedLogin, Banned, IP, Browser, LastLogin, Kommentar) VALUES (NULL, 'Luke', 'Luke', 'supersecretpassword', '3', '0', '0', '0', 'Unbekannt', 'Unbekannt', '2016-01-01 00:00:00', '');
The 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 'INSERT INTO BankUser (ID, Name, Admin, Password, AccessLevel, LoggedIn, Faile' at line 1
PHP Code:
foreach($Datenbankorganisation as $SQLDatei) {
$SQL = file_get_contents($SQLDatei);
$Result = mysqli_query($DB_LINK, $SQL);
if(!$Result) {
echo "<p>[".$SQLDatei."] <span style='color: red';>SQL-Fehler</span>: ".mysqli_error($DB_LINK)."</p>";
} else {
echo "<p>[".$SQLDatei."] <span style='color: green';>SQL erfolgreich</span>.</p>";
}
}
$SQLDateiSQLDatei? How are you building the query?file_get_contents? Its returning your query ?