Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Dynamic Photo Display Questions

Guest
Nov 19, 2010 Nov 19, 2010

I'm using CS5 to build a business website using a dynamic data setup.  It's using a "Holy Grail"  3 column div tag layout with the nav bar on the left.  I'm using PHPAdmin to build a MySQL database.  My goal is that if they click a product category like a fan or light fixture on the left, the center column will display a thumbnail image of the product, along with it's name and price.  If they click that display in the center, the full product description and full size picture will display in the right column.  It's going to be around 20,000 products when all said and done, which is why I don't feel like making that many pages or individual links.

I'm not sure how to get the images linked up to the database like that or about how to set the code in the site to have a loop that will display everything from that category in a neat list.

So far I've been referred to PHP and AJAX for this.  I don't yet have any insert, or display code in the site (thought I needed this part first).

The database is set up that the table has PRODUCT_ID, NAME, DESCRIPTION, PRICE, SALE_PRICE, IMAGE, CATEGORY.  I'm using PHPAdmin 3.2.0.1.  I don't know about how to do the image thing, I've been told to use binary data and to set the IMAGE field to text-type and just have the text be the image path.  That's honestly all I have to go on.

All I can find in any search engine or forum is just references to using BLOB formats and PHP code tailored to it, and on top of already knowing that's a bad idea, every comment and suggestion on those searches tells the same, but it's all I seem to find.  Any advice, suggestions, reading material?  For now I'm only using my computer for localhost testing, but the company has a small server network among it's buildings that will end up being the second phase of testing before we go live.

TOPICS
Server side applications
672
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Nov 19, 2010 Nov 19, 2010

Addendum:  AJAX looks pretty promising, but it doesn't seem to have a fast tool for what I need, although it does have some cool features.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 19, 2010 Nov 19, 2010

It sounds as though you're attempting to build a major project without first understanding the basic technologies that you need to be working with. My advice would be to start with a small prototype of what you eventually want to achieve. Building a database-driven site for 20,000 products is by no means impossible, but the last thing you want to do is to commit yourself to an underlying structure that can't later be changed without massive disruption.

Although images can be stored in a database, it's not recommended, particularly since you plan to have so many images. Images tend to bloat the size of the database table, and you run the risk of table fragmentation if images are frequently updated or deleted. It's far better to store details of the images, such as filenames and captions, in the database, but store the actual image files in the server's file system.

You might also find you need to store multiple images for a single product, so it would make more sense to store the images in a separate table, and link to the products table with foreign keys through a cross-reference table. Your categories should also be stored in a separate table to make searches more efficient, and to avoid redundancy of data.

If you're looking for helpful reading material, you might like to consider my book, "Adobe Dreamweaver CS5 with PHP: Training from the Source". It covers all the basic issues, such as image storage, basic database design, and working with PHP/MySQL. It also has a chapter that deals with Ajax in relation to images and text retrieved through a database query. You can see more details of the book on my site at http://foundationphp.com/phpcs5/.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Nov 20, 2010 Nov 20, 2010

Thanks.  David Powers?  I've actually been running through your tutorial on dynamic websites, and that's been extremely helpful so thanks on that as well!   The website won't be ready for launch for quite some time(my bosses understand that I'm working on this by myself and am relatively new to it).  My biggest challenge is setting up the database and figuring out how to draw from it in the way I described.  After that it's test, test, test.  Then I add a few hundred more and start all over testing.  Right now I'm working on a prototype with about 200 or so products of various categories.  I was trying to go with two tables, one for the lighting store, one for the electrical supply store.  That way when customers click on one of the store links it just pulls from the respective table.  In that case, am I right in thinking that it might be better to do two databases that have the stores saved seperately?  Or should I just have more tables on the one db?  I'm a recent graduate, the thing is they only really taught us the practical side on using table sites and basic links.  I understand the theory side of this, they covered it in pretty good detail, I just need some reference material like that book on the actual code/implementation side of it.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 20, 2010 Nov 20, 2010
LATEST

>I was trying to go with two tables,

>one for the lighting store, one for

>the electrical supply store.

Two tables? You understand that this project will require much more than two tables, right?

>In that case, am I right in thinking that it might be

>better to do two  databases that have the stores

>saved seperately?  Or should I just have  more

>tables on the one db?

It's hard for us to say without knowing much more about your business operations and project requirements. We typically have different databases for different business functions. For example, in a financial system database, we have separate databases for AR, AP, purchasing, etc.

Separating your business segments in different databases might make sense if they are run differently and have different functionality. But if they will be sharing other tables, then I would put them into the same database - possibly into the same product tables.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines