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

  • Home
  • SEARCH
  • 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 8090855
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T19:51:43+00:00 2026-06-05T19:51:43+00:00

i have been trying to pass some variables to model through the controller function

  • 0

i have been trying to pass some variables to model through the controller function so that the variable can be used in corresponding query from database.Here is my code

public function chooseGroup()
{
    $data['area']=$_GET['area']; //variable from a view source;this is loaded successfully in this function, i have printed an echo to be sure.
    $this->load->model('information_model',$data);
    $groupdata['rows']= $this->information_model->getGroupDetails();
  // var_dump($groupdata);
}

model code:

function getGroupDeatils() {
            $this->db->select('area'); //area is suppose to contain the value 
            $q = $this->db->get('group'); //group is the table name
            if ($q->num_rows() > 0)
                foreach ($q->result() as $rows) {
                    $data[] = $rows;
                }
            return $data;
        }      

the value $data[‘area’] for some some reason isnt being recognized by the information_model and so the query is not processed.where did i go wrong?:(
please help!

  • 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-06-05T19:51:45+00:00Added an answer on June 5, 2026 at 7:51 pm

    In your controller your call to the model should be like below

    public function chooseGroup()
    {
        $data['area']=$_GET['area']; 
        $this->load->model('information_model');
        $groupdata['rows']= $this->information_model->getGroupDetails($data);
    }
    

    And then in your Model declare the method like below

    function getGroupDetail($data) {
        // query code here
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been trying for half a day to loop this countdown function. I
I have been trying to get a jquery ajax function to return data from
I have been trying to write some code to find the average of numbers
I've been trying to develop a dynamic library in C++ that can be run-time
Okay I have been trying to get this to work for some time now.
I have a problem that I have been trying to solve for a couple
Have have been trying to make a validator for my xml files. I have
I have been trying to customize a navigation bar in an iPhone app. I
I have been trying to figure out how to get a list of all
I have been trying this for a little while nut just cannot get to

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.