0
CodeIgniterアプリケーションには検索エンジンがあり、条件に結果を追加したい。 モデルにあるコードの一部:CodeIgniterで構築された検索エンジンに条件を設定する方法
私が要求する条件にNULLに変更するにはどうすればよい$users = $this->search_model->getUsers(NULL)
:私が持っているコントローラで
$this->db->select(users.country_symbol);
と
function getUsers($conditions=array())
{
//Check For Conditions
if (is_array($conditions) and count($conditions)>0)
$this->db->where($conditions);
}
$this->loggedInUser->country_symbol
と同じcountry_symbolのユーザーですか?
function getUsers($conditions = array())
{
if (is_array($conditions) && count($conditions) > 0) {
foreach ($conditions as $condition) {
$this->db->where($condition['where'], $condition['value']);
}
}
// return results...
}
をそして、あなたはこれを行うことができます: