CodeIgniter Forums

Full Version: Calling class functions
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]edhrx[/eluser]
Hi I am having a problem using a class I created

I have a class with this in it

private function makeselect($tablename, $id, $displayfield, $currentvalue = "",
$useall=""){
Load of code .........
}

which just generates a html select


further down is
public function memsys_selectMembershipTypes($current){
$s = makeselect("membership_types","id", "name", $current) ;
return $s;
}

to use is load the library
and make a call to memsys_selectMembershipTypes("")
e.g. $select = Memsys_display::memsys_selectMembershipTypes("") ;

When I run it I get 'call to undefined function makeselect etc..

I think this is something obvious but can't see the wood for trees

Ed...

El Forum

[eluser]xwero[/eluser]
Code:
public function memsys_selectMembershipTypes($current){
$s = $this->makeselect("membership_types”,"id", “name”, $current) ;
return $s;
}

El Forum

[eluser]wiredesignz[/eluser]
Actually it looks like a static function call based on the initial usage.
Code:
public function memsys_selectMembershipTypes($current)
{
    $s = self::makeselect("membership_types”,"id", “name”, $current) ;
    return $s;
}