It looks like you're new here. If you want to get involved, click one of these buttons!
$this->load->module_model(FUEL_FOLDER, 'fuel_relationships_model');
$this->load->model('scratch_images_model');
$related = $this->fuel_relationships_model->find_all_by_candidate_table_and_candidate_key('image_themes', $themeid);
foreach ($related as $item) {
$img_id = $item->foreign_key;
$images[] = $this->scratch_images_model->find_one_by_id($img_id);
}
When I do a debug_query I get this:SELECT prizes.* FROM (`client_games`) JOIN `prizes_to_client_games` ON `prizes_to_client_games`.`game_id` = `client_games`.`id` JOIN `prizes` ON `prizes`.`id`=`prizes_to_client_games`.`prize_id` WHERE `prizes_to_client_games`.`game_id` = '1' ORDER BY `win_odds` desc, `id` asc
foreach ( $images as $img ) {
// do stuff
}
Comments
$images = array(); Then I'd check to see if $this->scratch_images_model->find_one_by_id($img_id); returns any value.
$this->fuel->pages->render('sweepstakes_game/$seg2/$seg3', $vars);
Doing it that way was taking me to a 404 page not found.
When I just go ahead and add the 2 variables to the $vars array like this it works
$vars['client_id'] = $seg2; $vars['client_game_permalink'] = $seg3; $this->fuel->pages->render('sweepstakes_game', $vars);
$config['max_page_params'] = array('sweepstakes_game' => 2);