I'm experiencing unexpected results from a query when using numbers as pattern. The query looks like this:
SELECT Code FROM table WHERE Code LIKE '%xxx%'
Everything is fine when xxx are letters, but when they are numbers the query returned by the remote PHP is wrong. It seems as if the starting %nn is interpreted as an ASCII code.
Example:
SELECT Code FROM table WHERE Code LIKE '%26F%'
is returned as: SELECT Code FROM table WHERE Code LIKE '&F%'
Javascript code sample:
find = "26F";
srch = "Code LIKE '%" + find + "%'";
url: "load_searched_record.php?target="+srch;
...
PHP simplified code:
$target = $_GET['target'];
echo $target;
Since I removed all the MySql code for testing, leaving only the above 2 rows, it is quite evident that the problem in originated from PHP, but why?
Should I encode in same way the query? If yes, how?
Thanks
Pls note that the PHP file is UTF-8 encoded.