Welcome Guest, Not a member yet? Register   Sign In
Error connecting to Database via class
#7

[eluser]macleodjb[/eluser]
now i get this error

Code:
A PHP Error was encountered

Severity: Notice

Message: Undefined property: Joes_class::$db

Filename: libraries/Joes_class.php

Line Number: 8


This is what's inside my class

Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');


class Joes_class {
    
    function get_industry() {
    $industry = "select * from industry where parentid = 0";
    $result = $this->db->query($industry);
    return $result;
    }



}?>

This is whats in my controller

Code:
class Register extends Controller {

    function Register()
    {
        parent::Controller();
        $this->load->database('default');
        $this->load->library('Joes_class');            
    }
    
    function index()
    {
        $data['page_title'] = "";
        $data['page_desc'] = "";
        $data['page_keywords'] = "";
        
        $this->load->view('account/register_form', $data);
        
    }
}

and this is how i am using it in my view page.

Code:
$industry_names = $this->joes_class->get_industry();


Messages In This Thread
Error connecting to Database via class - by El Forum - 01-26-2009, 05:25 PM
Error connecting to Database via class - by El Forum - 01-26-2009, 05:49 PM
Error connecting to Database via class - by El Forum - 01-26-2009, 06:03 PM
Error connecting to Database via class - by El Forum - 01-26-2009, 06:17 PM
Error connecting to Database via class - by El Forum - 01-26-2009, 06:36 PM
Error connecting to Database via class - by El Forum - 01-26-2009, 06:49 PM
Error connecting to Database via class - by El Forum - 01-26-2009, 07:11 PM
Error connecting to Database via class - by El Forum - 01-26-2009, 07:21 PM
Error connecting to Database via class - by El Forum - 01-26-2009, 07:38 PM
Error connecting to Database via class - by El Forum - 01-26-2009, 07:42 PM
Error connecting to Database via class - by El Forum - 01-26-2009, 07:45 PM
Error connecting to Database via class - by El Forum - 01-26-2009, 09:10 PM
Error connecting to Database via class - by El Forum - 01-27-2009, 06:09 PM
Error connecting to Database via class - by El Forum - 01-27-2009, 06:59 PM
Error connecting to Database via class - by El Forum - 01-27-2009, 07:09 PM
Error connecting to Database via class - by El Forum - 01-27-2009, 07:46 PM
Error connecting to Database via class - by El Forum - 01-27-2009, 07:50 PM
Error connecting to Database via class - by El Forum - 01-27-2009, 08:28 PM
Error connecting to Database via class - by El Forum - 01-27-2009, 08:33 PM
Error connecting to Database via class - by El Forum - 01-27-2009, 09:47 PM



Theme © iAndrew 2016 - Forum software by © MyBB