Forum Moderators: coopster

Message Too Old, No Replies

basic php/MySQL question re: directories

how do i setup and display subdirectories

         

billytt

3:31 pm on Feb 22, 2007 (gmt 0)

10+ Year Member



I'm very very new to php/MySQL but with the help of the Foundation PHP Dreamweaver book I've managed to set up a localhost and get started. I have what I'm sure is a real basic question. I'm trying to set up a directory of, let's say, 3 items (cars, bikes, boats). I then wish to break those down into subdirectories. I can manage to create the table in phpMyadmin, connect to the table in dreamweaver, build a recordset and display the 3 items on a page. I'm getting tripped up now when I want to create links to a second page to further break down the three items into subcategories.

For example, I'd like to be able to click on "cars" and pull (from a second table or database?) a second list which will display a sublist such as sedans, minivans, SUVs, etc. From those items, I'd like to link to a third page so that minivans or SUVs or whatever could be broken down further by manufacturer, such as Honda, Toyota, etc. I'd like to do the same with bikes and boats. Seems like it should be simple but I can't seem to put the right SQL script together in the Dreamweaver recordset. I can put the tables together in phpMyadmin but I'm not sure if I'm doing it right with the primary keys, etc. I can't seem to get the "cars, bikes, boats" to display the subcategories separately on the second page. I just seem to get a jumbled mess of all the different subcategories I want to set up. Any suggested directions/script is appreciated. Problem is, I don't even know enough to know what I don't know! Thanks in advance.

mcibor

4:10 pm on Feb 22, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



There are two options for you:
1. Create one table that will contain everything
2. (recommended) create three tables: one for cars, one for bikes, and one for boats.

Then pull the data with search query:

$sql = "SELECT * FROM $table GROUP BY manufacturer";
on next level
$sql = "SELECT * FROM $table WHERE manufacturer='$manufacturer' GROUP BY pruduction_year";

etc. I hope you grasp what I am trying to explain

Regards
Michal