hi everyone,

New to this.

Trying to build some kind of internet shopping place. I want to store lots of images and information articles in the MySql database.

Is this a good practice?

Where do most of internet shopping sites store their images and long articles.

Do they store in the database or server or as xml files.

Please tell me.

Thanks in advance

PHPDUDE

    The general consensus for images seems to be to store them as files in the file system, and only store information about them in the database (including path/filename info). Since you would (almost) never want to search the actual binary image data, there's not gain to saving it in the DB from a functionality standpoint, and having to retrieve it from the DB would likely put an unnecessary load on the DB server.

    Text may make more sense to save in the DB, even if it is "large" amounts, as you may want to take advantage of the database's search abilities against that text (such as using MySQL's full-text search feature).

      The flip-side to that argument is that IF you set up your tables correctly, you could actually have your store item images table reference your store items table. Then when you delete from store items the images too are gone. At least in Cake, it's easier to do that way sometimes.

      But there is a performance drop with speed and then getting images back from the DB won't load the fastest because now it's not just Apache that's serving the image, it's PHP.

      But it is possible to do it, and there are some advantages; however, they're not always the best advantages.

        Hi again,

        Thanks heaps for your replies.

        Let me see if I understood you correctly. You are saying:

        I make a database in MySql. And inside a images column, I simply put the URL to the images in the the server (eg. C:/websitename/images/123.jpg) or something like that.

        And phisically put all the products images in side the above URL in the server (and not inside the MySql database for better performance.

        But can put long articles about the products inside the MySql database directly in a Articles columns?

        Is that right?

        Another question?

        Do you think I can put say a thumbsize picture in the database and the in the HTML page, link that thumb to a larger picture in side the server images file?

        I am using Dreamweaver to build the pages. It can build Dynamic table, (meaning table is formed dynamically in accordance with the MySql database tables)

        Can you suggest where I can get some good ideas about building shopping store? Like tips on these kinds of matters.

        Thanks again for your help,

        PHPDUDE108

          You'd be better off just storing everything server-side and only the destination paths in the database.

          You can store any amount of text you please inside of the database. Just be aware that extremely long text can slow down some searches. So you may need to rely upon 3rd-party extensions for searching (like Sphinx for mySQL).

          As for shopping cart software, you'd be better off using something like ZenCart or osCommerce.

            Write a Reply...