Reputation: 389
public function data()
{
if($old != $status || $prev_lat != $lat || $prev_long != $long)
{
if($status == 'Village' || 'Unknown')
{
exec_query();
}
else if($status == 'Town' || 'City')
{
exec_query();
}
}
}
public function exec_query()
{
//Some data;
}
But whenever i call this function i get error like:-
Call to undefined function exec_query()
Can anyone tell me hw to call a function in cakephp
Upvotes: 5
Views: 9964
Reputation: 35973
Add $this->
before the name of the function like this:
public function data()
{
if($old != $status || $prev_lat != $lat || $prev_long != $long)
{
if($status == 'Village' || 'Unknown')
{
$this->exec_query();
}
else if($status == 'Town' || 'City')
{
$this->exec_query();
}
}
}
public function exec_query()
{
//Some data;
}
Upvotes: 15