Page 1 of 1

Trying to understand the basis of php for an online catalog

Posted: Thu Feb 18, 2010 3:38 pm
by Vestax159
Im trying to wrap my head around how a php based online catalog works.

Firstly, you establish your categories in a database and display them by calling each row. So for the example we will use the category of dogs. When you select the dog category you run a query which returns each product listed under dogs and you then display each row for the product list. When you select a product you are essentially selecting a row in the database which you then display that information for (product name, description, etc).

Now I think my difficulty is the product urls. Say I select the dog named Abby how do I produce a url like http://www.dogsforsale.com/Abby. For some reason I am finding it difficult to understand this concept without knowing how to establish a unique url for each product. Is it simple created based off the criteria I use to identify each row (Normally the primary key) or can I create a column named product url and assign that as the url?

Re: Trying to understand the basis of php for an online catalog

Posted: Thu Feb 18, 2010 4:07 pm
by Eran
Those are called clean-URLs. You should be directing traffic into one script that will accept a variable (or more) describing what page / product should appear. The most common way to achieve this is using apache's mod_rewrite
http://wettone.com/code/clean-urls

Re: Trying to understand the basis of php for an online catalog

Posted: Thu Feb 18, 2010 4:27 pm
by Vestax159
Forgive me, I see how that could change a url to be cleaner but could I make it change an items url to match that of a sql cell?

Re: Trying to understand the basis of php for an online catalog

Posted: Thu Feb 18, 2010 4:33 pm
by Eran
You should be directing traffic into one script that will accept a variable (or more) describing what page / product should appear.
The script should get the variable from the URL and fetch the required row from the database