Welcome Guest, Not a member yet? Register   Sign In
A PHP Error was encountered Severity: Notice Message: Undefined variable: company_n
#3

I'd suggest using row() at the end of your model query instead of result_array() because it's not returning a single object, it's returning an array of objects. 

so, you've two options...

1:
in your model: 

PHP Code:
$query $this->db->where('email'$login_email)->get('mytable')->limit(1)->row();
return 
$query



PHP Code:
// Controller

$vendor $this->vendormodel->vendor_details($login_email);

print_r($vendor);
// returned to your controller
//
// stdClass Object (  
// [company_name] => P.A
// [user_name] = SomeUser
// [IP_Address] = 127.0.0.1
// ...
//  )

$this->load->view('vendor_dashboard',$vendor); 


It's then converted to $company_name, $user_name, $IP_Address, etc in your view.


-----
Option 2 (while this will work, it's ugly and will cause confusion later)

Pass $vendor[0] in your view call.

PHP Code:
$this->load->view('vendor_dashboard',$vendor[0]); 

then access as $company_name, $user_name, etc in your view...
Reply


Messages In This Thread
RE: A PHP Error was encountered Severity: Notice Message: Undefined variable: company_n - by enlivenapp - 10-13-2016, 07:29 PM



Theme © iAndrew 2016 - Forum software by © MyBB