2013-08-06 37 views
1

在搜索雜貨CRUD時遇到問題,無法搜索到一個字段沒有結果,我無法獲得原始結果,「清除過濾」不起作用,並且刷新頁面會自動隱藏所有結果。謝謝! 這裏是我的代碼:在雜貨搜索CRUD中搜索時遇到問題,無法搜索到一個字段

$crud = new grocery_CRUD(); 

    $crud->set_table('p_user'); 
    $crud->where('parentid', $parent_id); 

    $crud->required_fields('name'); 
    $crud->columns('name','password','email','type'); 

    $output = $crud->render(); 

截圖: enter image description here

回答

0

我覺得你的問題是代碼:

$crud->where('parentid', $parent_id); 

你包括$ PARENT_ID的網址是什麼?因此,舉例來說,如果你有

http://www.example.com/main/test

它必須是:http://www.example.com/main/test/345或類似的東西。所以在你的情況下,我認爲這將解決你的問題:

if (!empty($parent_id)) { 
    $crud->where('parentid', $parent_id); 
}