too long

Thanks for viewing.

I'm trying to create a custom search plugin for my site to get values from my database rows to any query my user enters into the search box. I'm running ajax for my search plugin.

It seems to function initially but i realise that it doesn't occur for all values entered.

The following are my scripts:

.POST script

    $search=$_POST['search'];
    if($type=='search'){
        $query_str=$search;
        $query1="SELECT * FROM ads1_adsmanager_ads WHERE ad_headline LIKE '%$query_str%' OR ad_text LIKE '%$query_str%' ORDER BY id DESC LIMIT $count";
    }else if($type='normal'){
        .
        ..
        .. ..

I'm able to get the more general values like "demo",.. etc etc

But i'm not able to get values like "general", "jobs".. etc etc.

Been looking through lots of examples and trying all the brackets around the variable $query_str and all but i'm not sure if there is any syntax problem with my query that is affecting the results.

Will certainly appreciate some help here.

Query will be

$query1="SELECT * FROM ads1_adsmanager_ads WHERE ad_headline LIKE '%".$query_str."%' OR ad_text LIKE '%".$query_str."%' 

easiest way is to just check the query, just echo $query1 and you'll see the error, also like in comments a fellow said that try to put it in a query console which is in phpmyadmin and it'll also show you errors, if they are present