-2
I am making an application to save images, when the user does not choose any image is saved in the database a default image that is selected in another table of the database, but when saving the image in the database, php returns the following error:
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 ',,,,,'??? ' at line 1
Follow the code that searches the image in the bank and that displays it:
Seeking:
$query = "select imagem from imagem_padrao";
$imagem_padrao = mysqli_query($con,$query);
$imagem_padrao = mysqli_fetch_row($imagem_padrao);
$imagem_pronta = $imagem_padrao[0];
Insert:
$query = ("insert into tamanho (foto_aparelho) values ('".$imagem_pronta."')");
mysqli_query($con,$query) or die (mysqli_error($con);
I believe that the error is happening when inserting the image in array format in the database, but I do not know how to solve.
I think the problem is how you are defining the query, change the
$query = ("insert into tamanho (foto_aparelho) values ('".$imagem_pronta."')");
for$query = "insert into tamanho (foto_aparelho) values ('".$imagem_pronta."')";
, removing the first(
and last)
.– Inkeliz
Sorry the error is not in the syntax of Insert, this is a typo of mine, I will edit the post.
– ROBERTO ALBINO JUNIOR
You have to enter the code correctly because we often see people breaking their heads and the error is exactly in typing the code.
– user60252