Quick question about storing image NAMES in MySQL

Links for php scripts

Moderators: egami, macek, gesf

Post Reply
New php-forum User
New php-forum User
Posts: 14
Joined: Mon Apr 22, 2013 4:00 am

Mon Apr 22, 2013 4:10 am

Good morning programmers,

How do you insert an image name into a MySQL database?

For example - car.jpeg, bike.png

What is the code for storing a name with a decimal (.) in it?

Do I use blob, longblob, varchar?

Any suggestions would be great

User avatar
php-forum GURU
php-forum GURU
Posts: 2192
Joined: Wed Oct 06, 2010 11:19 am
Location: Happy Valley, UT

Tue Apr 23, 2013 12:56 pm

you can use varchar, and limit the amount of characters in a name... varchar(15) for example. Or, you can use tinytext, text, blob..

I would use varchar(21). This gives you 17 characters for a name, a period and 3 letter extension. You would need to have some sort of filter to make sure the name fits.. or just use tinytext, whatever fills your boat.

Code: Select all

$query = "INSERT INTO table ('filename') VALUES ('something.pic')";

For further information:

Post Reply