[thelist] matched pairs php + mysql

Luther, Ron ron.luther at hp.com
Tue Sep 21 07:14:38 CDT 2004


Andrew noted:

>>The html table will be different for every product so to componsate for
>>this I figure a 7 column 7 row table for inputting the data would cover
>>all senarios.  

Hi Andrew,

Sorry ... not sure I completely grok ... but I may have done something 
slightly similar a while back.

It's a very simple (and very cheesy) random "inspirational photo" kind 
of thing I built when I started playing with PHP (a couple of refreshes 
should show a change in font and background color): 
http://ronl.f2o.org/RLPHP/Inspire.php

All of the CSS, (background color, font color ... not real extensive), 
is served up from a db table and linked to a photo in the photo table. 
That way I can use a light background with one photo and a dark background 
with another.


Basically it uses two database tables: one to hold the data about the 
'product' (in this case a photo URL and that little comment at the 
bottom) and one to hold the CSS presentation information.

I'm thinking you might be able to expand on that. e.g.

(1) A 'Product Table' that holds your size, weight, price, description, 
small picture URL, big picture URL, comments, etc. kind of fields.

(2) A 'Product CSS Table' that holds all of your formatting information, 
photo dimensions, cell padding, cell spacing, '<hr>' definition, brand 
name logo if you are selling things from different suppliers, etc.

That way if a user wants to look at 'product # 17', you can make sure 
they see the presentation you want used with product # 17.

(This would also allow you to easily have a dozen 'similar' products 
all display in a similar fashion (by linking them all to the same 
CSS record) ... and have a different product family display differently.)


HTH,

RonL.


More information about the thelist mailing list