Welcome Guest, Not a member yet? Register   Sign In
Have problems with displaying data from database
#7

You're totally on the wrong track.
Did you start with reading (and understanding) the CI documentation and tutorial?

Your exhibitions.php goes into the application\views folder.

Don't load data and views in the construct of the controller.
The construct is just a function that runs every time there is a request to open one of the other functions in the controller.
In a controller that always needs a specific model or helper, you can load that in the construct.

Controller functions are called by the url in the browser.
E.g. www.mywebsite/products/overview/2019
products is the controller name (Products.php)
overview is the function name inside Products.php
2019 is an argument for the function, for instance if the function has this name:
PHP Code:
public function overview($year)
{
 
   // load data from a model here and pass the value of $year to the model to get the data for a specific year only.
 
   // load a view to display the data here, by passing an array with $data to the view.

Reply


Messages In This Thread
RE: Have problems with displaying data from database - by Wouter60 - 01-29-2019, 09:31 AM



Theme © iAndrew 2016 - Forum software by © MyBB