Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Development Tools

Storing image URL's in mySQL

Hi guys,

Can someone tell me how you would code a a column called 'images' which has values of URL links?

This is my table:

CREATE TABLE `photos` (
  `id` int(11) NOT NULL,
  `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`images` __________________???
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

I would be very grateful if you could help me.

Thanks!

1 Answer

URLs are just strings.

Earlier on I tried:

image varchar(255) COLLATE utf8_unicode_ci NOT NULL

and added the following url:

http://images.asos-media.com/inv/media/9/0/5/6/3476509/black/image1xl.jpg

mysql failed to run the statement. it just says error column count doesnt match.