Search for an image in a MySQL database with php and then save that image to another table in the same database

-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, however at the time of 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

Here is the code that looks for the image in the database and displays it:

Search:

    $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 think the error is happening at the time of inserting the image in array format in the database, but I do not know how to solve it.

    
asked by anonymous 22.02.2017 / 18:52

1 answer

0

I solved the problem otherwise, instead of storing the default photo in a database table, I left it as an image file inside the application server folder, so it worked as expected.

    
23.02.2017 / 12:10