Well, what you have is a good ol' parser error. The error gives you the exact information you need to debug your issue. This should be something you can do on your own really. PHP has a great way of handling errors and telling you exactly what went wrong and exactly where.
I see what the problem is immediately. Hopefully you didn't just copy/paste this from the tutorial, because there are several problems with incorrect use of quotes. For example, this line (which is probably what is giving your error later on in the script).
CODE
$query = "SELECT * FROM $table WHERE $field_to_search LIKE "%$trimmed%" order by id";
The first set of quotes are double quotes, so anything between double quotes that are not escaped with a backslash is interpreted as a string. So in this case, your string is '
SELECT * FROM $table WHERE $field_to_search LIKE ', which is not the entire string you want. The '
%$trimmed%' is not in the string, and really should have given you a parser error there for not having a correct deliminator for a concatenating a string. Replace the double quotes around the $trimmed variable with single quotes.
I also noticed several other problems of the
exact same nature. I'll let you hunt them down, as you should be doing if you are just learning PHP.