Welcome Guest, Not a member yet? Register   Sign In
I'm not completely confused by I've hit a road block with CI
#1

[eluser]Unknown[/eluser]
I built a site from scratch and I'm finally converting to a framework... CI.

So I have several pages that have more than one select statement query. I'm trying to follow the MVC design and put all calls to the database in a model. But how do I call multiple models in one control. How do I pass the $data of all these queries to the view if I ever get the calls to work.

Also i have functions that query the database and on some pages I call the function more than once. How do I do this in codeigniter? how do I call a model more than once?

Now I have gotten some pages to run on just a singl select query but I need more. And I don't know where or how to do the variables I need. ie should the variables be initialized in the controller than passed to the model this->get_model->get_this_function($variables)

How do I convert all my pages that look at query_strings. I don't see how to do it with uri because not every variable is required. So I guess I'm going to to have change everything to post instead of gets... is there a clear example of what I'm talking about? I mean the code.

All my static pages are working fine.

Worse case scenario I continue to call on db on the page (view) and try to figure this out down the line... it's really holding me up.

Can someone help. I mean I've searched I've read through the user_guide I'm at a lost.
#2

[eluser]Ajaxboy[/eluser]
Someone could spend all day explaining all these things.. but it would just be easier to review the documentation: http://ellislab.com/codeigniter/user-gui...odels.html
#3

[eluser]marjune[/eluser]
ok man i'll give you some spinet of how the MVC would appears to you.. first you should have your Model, Conroller, and View

for example in some of your view you need a bunch of queries in different tables,
in your controller(code below)

Code:
function index(){
      
         $data['firstquery']  = $this->modelname1->modelfunction1();
         $data['secondquery'] = $this->modelname2->modelfunction2();
         $data['thirdquery']  = $this->modelname3->modelfunction3();
        
         $this->load->view('yourview',$data);
    }

in your view you can now fetch the data of your firstquery, secondquery, thirdquery and so on and so fort...




Theme © iAndrew 2016 - Forum software by © MyBB