Help Please!!

<a href="check_user_asset_class_search.php?search=Plant & Machinery (General)" target="SEARCH_RESULT">Plant & Machinery (General)</a>

I want to searching for Plant & Machinery (General) in the database but only can search start from the word Plant the ampersand(&) is missing. How to solve this?

You need to encode spaces and special characters in your query string parameters. Ex. space must be presented as %20 etc.

Here is how your code should look:

<a href="check_user_asset_class_search.php?search=Plant%20%26%20Machinery%20%28General%29" target="SEARCH_RESULT">Plant & Machinery (General)</a>

If you’re generating your html code with php, you can use rawurlencode() function.

One other question is how did you store the data in the database?
Did you use any special formatting for the data? If not you can use an escape character to search it.
Depends on the format of your data in the database…

Also, please do not just use “help me” for a topic name. We will help, but, you will get a better response if you use something like ‘Using an ampersand in database query’ or something that makes sense. Thanks!

Sponsor our Newsletter | Privacy Policy | Terms of Service