Welcome Guest, Not a member yet? Register   Sign In
Extracting Data via Model
#1

[eluser]jzmwebdevelopement[/eluser]
Hey,

What do I put in my model function to enable me to call it from my controller like this:

Code:
$this->model->model_function->value

I currently have:

Code:
public function getCompanyDetails()
{
     $this->db->select('companyName,companySlogan,companyContact,companyEmail,companyWebsite,companyPhone,companyFax,companyAddress');
    
    
    $result = $this->db->get();
    
    return $result->result_array();
}
#2

[eluser]InsiteFX[/eluser]
Load the database and your model in your controller!
#3

[eluser]jzmwebdevelopement[/eluser]
[quote author="InsiteFX" date="1333772186"]Load the database and your model in your controller!
[/quote]

Opps sorry I have now updated the question I was meaning the model function
#4

[eluser]InsiteFX[/eluser]
Controller:
Code:
$data['name'] = $this->model_name->function_name->();
#5

[eluser]jzmwebdevelopement[/eluser]
[quote author="InsiteFX" date="1333772905"]Controller:
Code:
$data['name'] = $this->model_name->function_name->();
[/quote]

InsiteFX.

In my controller I have the following line:

Code:
$data['companyName'] = $this->quote->getCompanyDetails->$companyName;
    
    $this->load->view('home', $data);

I am getting Undefined variable in my view

in my model do I have to write
Code:
public function ($field){
for every row that I wish to call from the database?
#6

[eluser]InsiteFX[/eluser]
You need to read up on CodeIgniter and Databases because you dont understand anything about it!

CodeIgniter Users Guide - The Database Class




Theme © iAndrew 2016 - Forum software by © MyBB