Welcome Guest, Not a member yet? Register   Sign In
Fatal error: Call to a member function on a non-object
#3

[eluser]neverstop[/eluser]
Hi and tanks for the answer. Yes you are right in using $CI =& get_instance(); but still not working. I changed my code to a simple one, take a look:
Code:
<?php
class Main extends Controller
{
    function __construct()
    {
        parent::Controller();
    }
    
    function index()
    {        
        $this->load->library("Artigos");
        $val["title"] = "Altus :: Evoluçao em Automaçao";
        $this->Artigos->showArticles();
        $this->load->view("mainview", $val);
    }
}
?>
and
Code:
<?php
if (!defined("BASEPATH"))
    exit('No direct script access allowed');
    
class Artigos
{
    function showArticles()
    {    
        /*
        $CI =& get_instance();
        $query = $CI->db->query("SELECT * FROM artigos");
        $articles = "";
        foreach ($query->result() as $row)
        {
            $articles .= "<p><b>";
            $articles .= $row->date . "&nbsp;&middot;&nbsp;";
            $articles .= "<a href=\"#\">" . $row->name . "</a></b><br>";
            
            $content_complete = $row->content;
            $content_edited = html_entity_decode(substr($content_complete, 0, 120));
            $last_position = strrpos($content_edited, " ");
            
            $articles .= substr($content_edited, 0, $last_position) . "&nbsp;...</p>";
        }
        return($articles . $this->paginationArticles());
        */
    }
}
?&gt;
As you can see i commented the code of my function. And now whats the problem? Lol seems to be very simple but i can't get the solution to my problem =/. The same erros still ocurring.


Messages In This Thread
Fatal error: Call to a member function on a non-object - by El Forum - 01-16-2008, 07:08 AM
Fatal error: Call to a member function on a non-object - by El Forum - 01-16-2008, 09:32 AM
Fatal error: Call to a member function on a non-object - by El Forum - 01-16-2008, 10:01 AM
Fatal error: Call to a member function on a non-object - by El Forum - 01-16-2008, 10:10 AM
Fatal error: Call to a member function on a non-object - by El Forum - 01-16-2008, 10:19 AM
Fatal error: Call to a member function on a non-object - by El Forum - 01-16-2008, 10:53 AM
Fatal error: Call to a member function on a non-object - by El Forum - 01-16-2008, 11:16 AM
Fatal error: Call to a member function on a non-object - by El Forum - 01-16-2008, 02:08 PM
Fatal error: Call to a member function on a non-object - by El Forum - 01-16-2008, 02:20 PM
Fatal error: Call to a member function on a non-object - by El Forum - 01-17-2008, 04:21 AM
Fatal error: Call to a member function on a non-object - by El Forum - 09-07-2012, 01:10 AM



Theme © iAndrew 2016 - Forum software by © MyBB