select('*')->from('tab_rolename') ->where('roleName')->eq($name) ->orWhere('userID')->eq($uid) ->fetch_array(); $count = count($arr); $result = new stdClass(); $result->total = $count; $result->rows = $arr; echo json_encode($result);