2014-03-07 50 views
0

我的自定義搜索的元價值的工作,並使用這個不恰當的結果元值:搜索通過展示

print_r($_REQUEST); 
$args = array(
    'post_type' => 'property_post', 
    'posts_per_page' => 10, 
    'order' => 'ASC', 
    'meta_query' => array(
        'relation' => 'OR', 
        array(
         'key' => 'custom_textarea', 
         'value' => 'me', // if I use static keyword it works 
         'compare' => 'LIKE' 
        ), 
         array(
         'key' => 'custom_price', 
         'value' => array($_REQUEST['custom_price'], $_REQUEST['custom_price1']), 
         'type' => 'numeric', 
         'compare' => 'BETWEEN' 
        ), 
         array(
         'key' => 'custom_beds', 
         'value' => $_REQUEST['custom_beds'], 
         'compare' => '=' 
        ), 
         array(
         'key' => 'custom_bath', 
         'value' => $_REQUEST['custom_bath'], 
         'compare' => '=' 
        ), 
         array(
         'key' => 'custom_garage', 
         'value' => $_REQUEST['custom_garage'], 
         'compare' => '=' 
        ) 
        ) 

); 

如果我使用的meta值一些靜態的關鍵字,然後它的工作原理,但與$_REQUEST事實並非如此。 我通過print_r($_REQUEST)檢查了$_REQUEST

Array ([custom_textarea] => aa[custom_price] => 1000 [custom_price1] => 4000[custom_beds] => 2[custom_garage] => 1) 

那麼我該怎麼做纔好。

在此先感謝.........

回答

0

商店的$ _REQUEST值,一些變量並在查詢

  $a=$_REQUEST['custom_price']; 

 'value' => $a, 
+0

不會使用它有什麼區別...? – Dinesh

+0

我在我的程序中使用過這種方式,因爲您正在獲得$ _REQUEST值。 – akhila