How to add images in a mysql database using php? you don’t.
bruhh
but why should i add image to db
if you make a php based social media or something

Please don’t 😭, please stop. And use a proper package for db queries. Doing raw queries like this is waiting for sql injections.

I would look into SQL injection prevention. You have a lot of vulnerabilities when you put a variable directly into a SQL query, if this were public anyone could just delete, download, or do anything to your tables. I’m sure you’re just getting started so it’s not a big deal, but I would check that out next if I were you.

Also, what any social media site would do is just upload the image to the server instead of saving it in the database. You would then save the URL to go to the image in the database.

source