It looks like you're new here. If you want to get involved, click one of these buttons!
function list_items($limit = NULL, $offset = NULL, $col = 'last_name', $order = 'asc')
{
$CI =& get_instance();
$user = $CI->fuel_auth->user_data();
if ( $user['super_admin'] == 'no' ) {
$this->load->model('clients_model');
$this->load->model('players_to_clients_model');
$client = $this->clients_model->find_one_by_fuel_user_id($user['id']);
$client_id = $client['id'];
$this->db->select("DISTINCT players.id, players.first_name, players.last_name, players.email, players.status, players.power_play_balance, players_to_clients.client_id as promoter_id", FALSE);
$this->db->from("players_to_clients,clients");
if( !isset($_GET['exported']) )
{
$where = array('clients.id' => (int)($client_id),
'players_to_clients.client_id' => (int)($client_id),
'players_to_clients.player_id' => 'players.id',
'exported' => 0);
} else {
//echo $_GET['exported'];
$where = array('clients.id' => (int)($client_id),
'players_to_clients.client_id' => (int)($client_id),
'players_to_clients.player_id' => 'players.id');
}
$this->db->where($where, NULL, FALSE);
} else {
$this->db->select('DISTINCT players.id, players.first_name, players.last_name, players.email, players.status, players.power_play_balance', FALSE);
}
$data = parent::list_items($limit, $offset, $col, $order);
return $data;
}
if( isset($_GET['exported']) )
{
//echo $_GET['exported'];
$where = array('clients.id' => (int)($client_id),
'players_to_clients.client_id' => (int)($client_id),
'players_to_clients.player_id' => 'players.id');
} else {
echo $_GET['exported'];
$where = array('clients.id' => (int)($client_id),
'players_to_clients.client_id' => (int)($client_id),
'players_to_clients.player_id' => 'players.id',
'exported' => 0);
}
Comments
I just changed the above if statement to be:
if( !isset($_GET['exported']) ) { echo "NOT SET"; $where = array('clients.id' => (int)($client_id), 'players_to_clients.client_id' => (int)($client_id), 'players_to_clients.player_id' => 'players.id', 'exported' => 0); } else { echo "ISSET: " . $_GET['exported']; $where = array('clients.id' => (int)($client_id), 'players_to_clients.client_id' => (int)($client_id), 'players_to_clients.player_id' => 'players.id'); }
and it's not running the 'else' side of the statement. I've ben staring at this for so long I bet there's something right under my nose that I can't see. Help!!
$config['allow_get_array'] = TRUE;
$config['enable_query_strings'] = FALSE;
http://www.getfuelcms.com/forums/discussion/1118/select-where-query-run-twice/#Item_12