Insert an Image in a MySQL database

Ask a question


I am creating a website to purchase books online using PHP and MySQL, and my problem is:
How to store images of books in a database knowing that the photo of each book should appear in the consultation of books offered on the site. I know that to store images in a database slows down query execution... What is the method better than the latter? Thank you in advance.


I think the easiest way is to store the picture link in the database and not the image itself.
  • Make a column for example img_src and paste the link to your photo.
  • Example: C: \ www \ site \ images \ myphoto.jpeg
  • When generating page views, make:
    • SELECT * FROM MyTable WHERE ID = 1
  • You will have all the information, simply paste it in a table.

Solved by Skeletyon

Store the value of a textbox
WampServer- localhost issue