Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP

php challenge I want to create new sections like pants, hats, to my project

i am on php enhacing the store online... but I try to make new sections like hats, jeans, pants, but i dont really know what i have to do exactly... i should create a new products.php for my pants section... plz help me...

2 Answers

Randy Hoyt can you make new sections for the store online like jeans, pants, hats and teach how to do it please. i need to create new sections for my project... thanks

Hey max,

The easiest way to accomplish this is to learn as much about databases as possible!

When you're adding new stuff like this, you need to think very carefully about the data model that sits underneath. Once you have the data model - i.e. the database and tables working well together - you can make the front end do anything.

There are so many different ways to look at this.. but I would probably start off by looking at hats, jeans and shirts etc as different types of products - therefore they should all exist on the same 'products' table. They all have a field for price and catalogue number etc... so it makes sense to group them together as 'products'.

You then need to figure out how you're going to differentiate product types. Like you did with the shirt sizes, you could extract 'types' into a joining table and assign each row of the products table to a type via the 'type.id'. Each type is going to require different attributes.. so some sizing might be in inches, others in S, M L, XL etc. You might also need a join table for attributes like color and male/female.

Spend some time working out the tables in your database and the relationshups you're going to need and it should become a lot easier. The database course on Treehouse is pretty good, so definitely check that out.

I hope this helps

thanks i will take the database course then... because i want to create new sections... jeans, hats,like a store online does...because i need to learn this for my project ! thanks tom