Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2002
    Posts
    1

    Unanswered: storing file locations and url's in database

    Hi,

    I'm new to Mysql and was wondering if it is possible to create a column that would store the location of a .jpg file and when I called it using php the image would appear (not the location of the image) what data type should I use and is there anything special I would need to do to call the file? Thanks.

    Joel

  2. #2
    Join Date
    Aug 2002
    Posts
    2
    When you query a MySQL database with PHP, you're going to get back whatever is stored in the database. So, if you store a filename, you're going to get a filename. Then you could use PHP commands to open that file and display the image. There's also a column type in MySQL called BLOB which stands for Binary Large OBject, and this can store things like images in their entirety. Then when you queried the MySQL database, you would get the image back (in binary form, of course). But this will take up a bunch more space than just storing the filename. Perhaps the best idea would be to have one table storing images as BLOBs (and primary keys) and then just storing a foreign key in your other database. This is best if you're going to be using the same image many different times in your table.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •