Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6858187
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T02:07:34+00:00 2026-05-27T02:07:34+00:00

So the scenario is this: I currently have a DB with TV Shows with

  • 0

So the scenario is this:
I currently have a DB with TV Shows with RSS Feeds.
The feeds (TV Shows) table has ID, name, network, feed, active.
I have setup a field in the accounts table called favourites, i thought comma delimited ID’s of the TV Shows might be a good idea, but im not sure anymore.

I am currently looking to implement a controller in CI that will look at the DB in the favourites field, for eg if it was filled with 104,149,150

How can I get those ID’s to transfer into the view so I can set the values to the respective Show’s?

    <?php foreach ($shows as $show) { ?>

             <div class="grid_1">
              <?  $data = array(
    'name'        => $show['name'],
    'id'          => $show['id'],
    'value'       => $show['name'],
    'checked'     => FALSE,
    );

echo form_checkbox($data); ?>

            </div>

            <div class="item"><?=form_label($show['name']);?></div>

                       <?php } ?>

The view currently outputs the TV shows in the database with a check box next to each show, what is the best way for me to set user preferences for favourites? So that I can set the values of each checkbox according to the user preference

I hope I have explained what I am trying to do well,

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T02:07:35+00:00Added an answer on May 27, 2026 at 2:07 am

    You can load a view and send variables/parameters to it as such:

    $params['data'] = array(1 => 'hello');
    $this->load->view('path/view.php', $params);
    

    EDIT:
    To save favorites, I suggest creating a new table (‘favorites’) that contains a favorite_id, user_id, show_id .. perhaps a date added, maybe some other things.

    In the Shows page, where the checkboxes reside, you could do the following:

    <input type="checkbox" <?=(in_array(SHOW_ID, $favorites) ? 'checked' : null);?> />
    

    This means you must send over an array called $favorites which would look something like $params['favorites'] in your controller.

    The query to get the favorites would look something like this:

    $q = $this->db->query('SELECT show_id FROM favorites WHERE user_id=?', array($user_id));
    $params['favorites'] = $q->result_array();
    

    The array($user_id) following the query is called query binding, used for security.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

SCENARIO (iOS 5) I currently have a UITableView. It has 30 table rows The
Imagine this scenario: You have a desktop and a laptop. The desktop has a
In this scenario, I have 2 or more models: class Store(models.Model): name = models.CharField(max_length
This is my current scenario: I have checked in my grails app code +
Consider this scenario. I have my own website, that I use as my identifier,
Consider this scenario. I have an object, lets call it.... Foo. Foo raises a
I have this scenario well, i'll let the model explain. public class ScheduleMonthlyPerDayModel {
The Scenario: I have the following (simplified) database table scenario: ID ProductName ProductCategory Colour
I have a specific scenario that I want to solve. I currently connect to
Scenario I'm moderating a website that has moved to a Wordpress based setup, but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.