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 Enhancing a Simple PHP Application Adding Search: Model Performing the Search

Shelby Sarisky
Shelby Sarisky
6,536 Points

Incorporating a Search feature into your site.

Randy's tutorial explains how to incorporate a basic search function into your site, does anyone have any suggestions for other articles or tutorials that builds off of this basic search explanation?

I have a website I am building that includes multiple types of products that are in different named arrays. I am just looking for some type of explanation on how to set a up a search when you have a multitude of arrays instead of just one.

2 Answers

Andrew Shook
Andrew Shook
31,709 Points

Shelby Sarisky,

I think you best beat would be to use a database. If you watch the PHP & Mysql videos Randy goes over, the process of taking product information out of a php array and putting it into a database. Personal I think that is the best way to go because a database will give you a more robust search functionality and you wouldn't need to search multiple arrays. If you have any questions about how to setup a database or the best ways to use php to query the database just post another question here and I'll try to help.

Shelby Sarisky
Shelby Sarisky
6,536 Points

Thanks Andrew, I will look into that, I appreciate your suggestion.