Welcome Guest, Not a member yet? Register   Sign In
[Solved] Active Records DB Model
#1

(This post was last modified: 03-22-2015, 03:33 PM by wolfgang1983.)

When I search in my input put field with the model below. If there is the word that I type does not match the throws foreach error how do stop that?

A PHP Error was encountered

Severity: Notice
Message: Undefined variable: user_groups
Filename: user/users_group_list.tpl
Line Number: 85
A PHP Error was encountered
Severity: Warning
Message: Invalid argument supplied for foreach()
Filename: user/users_group_list.tpl
Line Number: 85

Throw errors only show up if type something that does not match what the best way so if I type something that does not match will not throw errors

PHP Code:
public function getUserGroups($limit null$offset NULL) {
$this->db->select("user_group_id, name");
$this->db->from($this->db->dbprefix 'user_group');
$this->db->limit($limit$offset);
$this->db->order_by('name''asc');
$data = array(
'name' => $this->input->post('name'),
'user_group_id' => $this->input->post('user_group_id')
);
$this->db->like($data);
$this->db->or_like('name''match');
$this->db->or_like('user_group_id''match');
$query $this->db->get();
return 
$query->result_array();

There's only one rule - please don't tell anyone to go and read the manual.  Sometimes the manual just SUCKS!
Reply


Messages In This Thread
[Solved] Active Records DB Model - by wolfgang1983 - 03-16-2015, 07:07 AM
RE: Active Records DB Model - by CroNiX - 03-16-2015, 07:46 AM
RE: Active Records DB Model - by wolfgang1983 - 03-16-2015, 04:09 PM



Theme © iAndrew 2016 - Forum software by © MyBB