Error "Too few arguments to function"

23,409

You call the function like this: $this->GetTabellen_ns()

But function needs two arguments (offset and limit).

If you want to set these argument as optional argument, you can give them a default value like this:

protected function GetTabellen_ns($offset = 0, $limit = 0){
 .
 .
 .
}
Share:
23,409

Related videos on Youtube

GermanMech
Author by

GermanMech

I want that badge.

Updated on November 10, 2020

Comments

  • GermanMech
    GermanMech about 2 years

    I got an error in the following code piece: Too few arguments to function showtbl::GetTabellen_ns(), 0 passed in abcde/folder/php.php on line 153 and exactly 2 expected

    Don't know why I get this. I'm quite new to PHP Prado and in all programming so maybe a stupid mistake.

    protected function GetTabellen_ns($offset, $limit) 
    {
        $criteria=new TActiveRecordCriteria;
        $criteria->Condition = 'name = $name';
        $criteria->OrdersBy['name'] = 'asc';
        $criteria->Limit = 15;
        $criteria->Offset = 20;
        return prdtblRecord::finder()->findAll($criteria);           
    }
    protected function populateData_ns($offset, $limit) 
    {
        $offset=$this->Repeater->CurrentPageIndex*$this->Repeater->PageSize;
        $limit=$this->Repeater->PageSize;
        if($offset+$limit>$this->Repeater->VirtualItemCount) {
            $limit=$this->Repeater->VirtualItemCount-$offset;
        }
        $this->Repeater->DataSource=$this->GetTabellen_ns($offset,$limit);
        $this->Repeater->dataBind();
    }
    

    Thx for help hope someone can help me.

    edit: If someone can tell me how $offset and $limit get set would help me alot too.

Related