HomePHP Creating a Searchable Inventory System: Retrieving and Managing Search Results (continued)
Creating a Searchable Inventory System: Retrieving and Managing Search Results (continued)
In this article, we will set up an automatic search listener to execute the code for our searchable inventory system. With this final piece, we will assemble all of the parts of our application into a working search tool. It will allow us to search for records using any combination of the search forms, as well as sort those records by almost any of the resulting column headers.
In the previous article, we introduced some important concepts, the most important of which was the “get_search_results” function. This function pieces together all of the static elements of our SQL query (located within the “inc.conf.php” file), and appends all of the dynamic, user-driven portions as well into a complete SELECT statement that allows us to retrieve an organized set of results and return them in the form of an array. This array can then be displayed in any manner we see fit within our “index.php” file.
All of the logic is now in place to run our search, but we have not yet set up a search listener to execute the code. Let’s take a look at that now.