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! While you're at it, check out some resources Treehouse students have shared here.

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 Build a Basic PHP Website (2018) Listing and Sorting Inventory Items Associative Arrays

Andrew G
Andrew G
7,541 Points

How would you approach generating the arrays for a much larger media library, for example 500+ items?

This makes sense, but if you needed to create a much larger media library (as most would be) how would you handle generating the arrays for a much larger media collection, for example 500+ records, if you don't intend to use a DB?

1 Answer

I’m not entirely sure what you’re referring to. I’ve watched the video linked to this post about arrays but I don’t know if you’re referring to a challenge after the video?

Either way, in a real project you would use a database to store any kind of product information. I mean arrays are okay for a few products but you might as well setup the project with a database to begin with, you’re only giving yourself more work if you don’t use a database.

Andrew G
Andrew G
7,541 Points

What I'm referring to is that for a real media library, unlike the example we are building, you would have many more items, so you wouldn't be manually adding the data into arrays. As you mentioned, a database would do the job. However, I know a lot of sites don't use their own databases to store items, but feed the data through API's via third party apps these days, so it would be good to learn more about how this is done. Any course you'd recommend? Thanks for the reply..

There are a few things in the library but I’ve not watched them myself. I do know what you mean though, have a look on the library anyway at the api stuff, you might find something on there. Sorry I couldn’t be of more help with this.