Board index   FAQ   Search  
Register  Login
Board index PHP PHP Scripts

Quick question about storing image NAMES in MySQL

Links for php scripts

Moderators: macek, egami, gesf

Quick question about storing image NAMES in MySQL

Postby phpnewbie34 » 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
phpnewbie34
New php-forum User
New php-forum User
 
Posts: 14
Joined: Mon Apr 22, 2013 4:00 am

Re: Quick question about storing image NAMES in MySQL

Postby egami » 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:
http://us2.php.net/mysql_query
User avatar
egami
php-forum GURU
php-forum GURU
 
Posts: 2197
Joined: Wed Oct 06, 2010 11:19 am
Location: Happy Valley, UT


Return to PHP Scripts

Who is online

Users browsing this forum: No registered users and 0 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.