Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

insert images into mysql db

Status
Not open for further replies.
Aug 18, 2003
111
GB
Does anyone know how i write an insert query to add jpg images to my database table.

 
IT's usually not a good idea to keep images in a DB but rather keep the links to the images. and store the images in a folder on the server.

The field would then only contain a link the image.

Such as: \imagefolder\myimage.jpg

And the insert would be a normal insert Insert INTO mytable imagelinkfieldname values("\imagefolder\image.jpg");

If you must really insert an image into a DB look into the Blob datatype. in the MYSQL online manual.



----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Thanks for the link. You don't happen to have the actual query i need to use to insert them do you?

I seen that in a lot of forums that you should only store the pointer and not the image.

I needed to use the image because i'm using crystal reports 9 which cannot read file pointers and display the image. According to Crystal's website the only work around for version 9 is to store the images in a database. Apparently version 11 can read file pointers.

If you know of anyway to get different images for each record in crystal reports, please let me know.
 
Something like this:
Code:
nsert into mytable values (load_file("\location\of\file\in\server\file.jpeg"));



----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top