[thelist] MySQL CREATE TABLE - img file??
Ben Phillips
ben at inchima.com
Tue May 14 06:11:01 CDT 2002
> What is the syntax to include an img? I am trying to create a
> little database which can have an img included with the entry.
>
> so far I have:
>
> CREATE TABLE courses (
> id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
...
> photo ???????
> );
there are two ways of doing this. if you really want to store the image
file in the database, you have to use the BLOB type.
http://www.mysql.com/doc/B/L/BLOB.html
however, you can also use the primary key of the record to reference the
actual image file stored on the server. for example, the table 'courses'
could have a record with an id of '1002'. the file could be stored on
the server at '/public_html/courses_photos/1002.jpg'. this way, the
database doesn't need to store the image data (which could be very
large).
here is an article (for mysql, oracle & ms sql) about storing images:
http://www.zdnetindia.com/print.html?iElementId=139
benji
inchima.com
More information about the thelist
mailing list