Witam, mam taki kod: (zmienna $nazwa jest zdefiniowana we wcześniejszej części kodu jako htmlentities($_POST['nazwa'], ENT_QUOTES, "utf-8");
$dir = 'grafika' . DIRECTORY_SEPARATOR . 'meble' . DIRECTORY_SEPARATOR . $next_id . DIRECTORY_SEPARATOR;
for ($j = 0; $j < $file_count; $j++) {
$sl_id = $j + 1;
$sizex = 1280;
$sizey = 720;
if (!$mysqli->query(sprintf("INSERT INTO tabela_slider VALUES('$next_id', NULL, '$sl_id', '$dir', '$sizex', '$sizey', '%s')",
mysqli_real_escape_string($mysqli, $nazwa)))) {
echo $mysqli->error;
$mysqli->close();
die('Blad polaczenia');
}
}
Większość walidatorów SQL twierdzi, że moje zapytanie jest w porządku, jednak mysqli::error wywala to:
You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '1280', '720', 'Fotel')' at line 1
Z góry dziękuję za pomoc