I've a query here :
$sql = "SELECT ID,post_title,post_content,post_date,post_type
FROM {$wpdb->posts}
WHERE post_content LIKE {$stuff}
AND post_status = 'publish'
AND post_type = '{$post_type}'
AND ID != {$post->ID}
LIMIT {$limit}";
$results= $wpdb->get_results($sql);
$stuff is a %keyword% and $post_type is a post type slug, the odd thing here is that when I use e.g. articles as post type, results also contains posts with revision status and page or post type and it seems that if statements like post_type = '{$post_type}' and post_status = 'publish' doesn't work at all!!
What should i do?
Update
I did a print_r() for $sql :
SELECT ID,post_title,post_content,post_date,post_type FROM wp_posts WHERE post_content LIKE '%Battery%' OR post_content LIKE '%Watcher%' OR post_content LIKE '%Widget%' OR post_content LIKE '%matches%' OR post_content LIKE '%built%' OR post_content LIKE '%HTC%' OR post_content LIKE '%widgets%' OR post_content LIKE '%Please%' OR post_content LIKE '%check%' OR post_content LIKE '%Thrutu%' OR post_content LIKE '%day%' OR post_content LIKE '%job%' OR post_content LIKE '%app%' OR post_content LIKE '%donate%' OR post_content LIKE '%buying%' AND post_status = 'publish' AND post_type = 'articles' AND ID != 1388 LIMIT 4
%keyword%? Also,var_dumpyour$sqland verify that all of the parameters are being set correctly?