Cant seem to figure out whats wrong, the query should be correct, and it works in phpMyAdmin but when I introduce a wildcard into the php string "%", every query fails.
This works:
$query = sprintf("SELECT `id`FROM `table`WHERE `name` LIKE '".$resources[1]."'",
mysql_real_escape_string($resources[1]));
This does not:
$query = sprintf("SELECT `id`FROM `table`WHERE `name` LIKE '%".$resources[1]."%'",
mysql_real_escape_string($resources[1]));
The query Im obviously trying to generate is
SELECT `id` FROM `table`WHERE `name` LIKE '%someName%'
echo $query;tell you? Can you make an example of that kind of value you are searching? Don't forget that a leading%requires that there be something in front of the value, so searching for%Michael%will not give youMichaelTaylor$queryis empty in the second example? That seems unlikely.