Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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.