Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Opinion time Using PHP/MySQL and images

Posted on 2002-05-21
4
Medium Priority
?
230 Views
Last Modified: 2006-11-17
Hello -

I'm creating an ecommerce site using PHP/MySQL. The site (like lots of sites) will have images related to the items that are being sold.

1) Should I add each ites to the db or
2) Just provide links?

Let me explain more -

The user will come to the site, view the items for sale, put a number in the 'edit' box, and continue to shop. Once they head to the checkout, the products will then be purchased. Since the items will be viewed outside the cart, does it make since to just store them in a folder and provide links under each item (for viewing) or should I add them to the db (for management reasons)?

What is the best way to product a SKU (or ID) for each item? My guess is to store them in a db and let the db track the ID prefix with something to help ID the product.

If you need more information, please let me know.

Jim
0
Comment
Question by:JPersinger
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 5

Accepted Solution

by:
andriv earned 200 total points
ID: 7025690
Adding images to the DB will slow down your program dramatically. Image files are big and takes time for the queries to go through each record (especially if there are a lot of images).  Best to use links.
0
 
LVL 7

Expert Comment

by:axis_img
ID: 7025800
I agree as well...

If you were talking about storing the binary data of the image in the database, then definitely not. There are very few reasons to do that, and this does not happen to be one of them.

Just make a consistent set of rules for the product image names and directory structure, and then simply store the image's file name in the database. When you are displaying the item information from the database, simply pull the file name from the record as well and throw that into the <img> tag.

Regards,
Barry
0
 

Author Comment

by:JPersinger
ID: 7025916
Since andriv had what looks like the best all around solution, I'll award the points to him/her. I think I'll make each file thumb size and allow them to be clicked to enlarge the file. Does any one of a script that will will reduce the file size until clicked?

Thanks again -

Jim

0
 
LVL 5

Expert Comment

by:andriv
ID: 7028227
Glad I can help.
0

Featured Post

Enroll in October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to count occurrences of each item in an array.
Suggested Courses

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question