Welcome Guest, Not a member yet? Register   Sign In
PHP4: Call to a member function on a non-object

I developed my application using PHP5. Now I was made to run it on old PHP 4.3.8

It returns an error "Call to a member function on a non-object" on lines

if (!$this->selecty_model->isVyrobce($vyrobce)) {$vyrobce = "";}
if (!$this->selecty_model->isProjektor($projektor)) {$projektor = "";}

I know it it's probably my mistake. But what is wrong?
I grow up on PHP5, I don't know PHP4 pretty much.

Thanks for your help

is the model loading correctly? you could put some dbug in.

How your model looks like? Do you use PHP5 specific magic methods (__construct(), __destruct(), etc...)?

On PHP5 it works fine.

The model:

class Selecty_model extends Model {

    function Selecty_model()

    function isVyrobce($vyrobce){
            $CI =& get_instance();

I really don't know... :-(

If I was in your shoes start from basics, as what you have provided looks ok.

create a fresh controller and model
then create a method in the model that just has the line echo "hello";
then load and call the method from the controller.

you can then satisfy your self that you can load models correctly.

My suspicion is that your model has php5 specific code (maybe you are using a php4 reserved word) in it somewhere and so it is not loading, turn your log_threashold on to 4 by setting the config parameters and see if you get any clues in the log.

Theme © iAndrew 2016 - Forum software by © MyBB