This course will be retired on June 1, 2025.
Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Start a free Courses trial
to watch this video
We have created our search form, and a visitor to our site can enter a search term and submit it to the server. Let us now load that search term into a php variable on our catalog page and start making the modification we will need to perform the search.
Links
SQL Like Operator
SQL Wildcards
Example Code
if (!empty($search)) {
$result = $db->prepare(
$sql
. " WHERE title LIKE ?"
);
$result->bindValue(1,'%'.$search.'%',PDO::PARAM_STR);
}
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up