Question: PHP Part VI - Creating a search form for MockUsers Create a PHP page containing a form which allows the user to enter a search
PHP

Part VI - Creating a search form for MockUsers Create a PHP page containing a form which allows the user to enter a search term. Use this search term to find users in the MockUsers table of your database. The form should submit the query string to the same page using the GET method. If a search query is provided, your page will connect to your database and search the MockUsers table for entries matching the user-provided search query. The query should try to find a match in the first_name, last_name, or email columns Match partial strings using the LIKE keyword in SQL. The trick to doing this is to add a % to the beginning and end of the search term in PHP before using it in a prepared statement. For example, partially matching on first_name: $stmt = $db->prepare( 'SELECT * FROM Mockusers WHERE first_name LIKE $stmt $db->execute('%" . $search-term . '%"); Print the results of the query in a table below the form. If no results are found, display a message along the lines of "No results found." ?')
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
