Site icon Hip-Hop Website Design and Development

$wpdb question for value in customized discipline worth

A classifieds record web site have solely 3 criterias when looking merchandise: the widespread search, class and area (for ZIP, metropolis or full deal with) It isn’t sufficient and I actually need to incorporate a primary value system, so customers can set a value vary earlier than looking.

Wanting on the theme information, I discovered the perform for various queries, primarily based in a number of of these criterias. The smaller is the question for less than class, so I will take it as instance:

elseif ($s_for == '' && $s_cat !== '' && $s_to == '') {
$question = "SELECT $wpdb->posts.*
FROM
$wpdb->posts
INNER JOIN $wpdb->term_relationships
ON $wpdb->posts.ID = $wpdb->term_relationships.object_id
WHERE
$wpdb->posts.post_type = '$cc_post_type'
AND ($wpdb->postmeta.meta_key = '$cc_price' AND $wpdb->postmeta.meta_value LIKE '%$s_prc%')
AND $wpdb->posts.post_status = '$cc_post_status'
AND ($wpdb->term_relationships.term_taxonomy_id = {$s_cat})
GROUP BY ID {$restrict}";
}

Product costs are saved in customized fields (cc_price), so I attempted…

AND ($wpdb->postmeta.meta_key = '$cc_price' AND $wpdb->postmeta.meta_value LIKE '%$s_prc%')

…with a easy checkbox ($s_prc added to features) with the worth (only for testing functions), however it doens’t work, “question with no outcomes”. Is the question right and I am mistaken in another level?