Dominik
Dominik

Reputation: 4778

CakePHP - Fatal error: Call to undefined function

I get the following error:

Fatal error: Call to undefined function getAvnet() in C:\xampp\htdocs\ems\app\controllers\queries_controller.php on line 23

The line is:

$ret = getAvnet('de', $searchstring);

supposedly calling

function getAvnet($country, $query)

Upvotes: 7

Views: 13241

Answers (2)

Ranjith
Ranjith

Reputation: 1

$ret = $this->getAvnet('de', $searchstring);

Upvotes: -2

quantumSoup
quantumSoup

Reputation: 28192

You need to use

$ret = $this->getAvnet('de', $searchstring);

In general you need to use $this-> when accessing class methods and variables.

Read: http://php.net/manual/en/language.oop5.basic.php

Upvotes: 17

Related Questions