5

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.

D.Dimitrioglo
  • 3,413
  • 2
  • 21
  • 41
GermanMech
  • 63
  • 1
  • 1
  • 12
  • On line 153 you are probably calling `$this->GetTabellen_ns()` instead of supplying the two **required** arguments like: `$this->GetTabellen_ns($offset, $limit)` – rickdenhaan Nov 09 '17 at 11:17
  • THX this was right! but now i need to know where to set them – GermanMech Nov 09 '17 at 11:23
  • You need to provide them to the function call yourself on line 153. It doesn't look like that line is in your question (the call in `populateData_ns` already has them) so it's impossible to say what values they need to have. – rickdenhaan Nov 09 '17 at 11:25

1 Answers1

17

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){
 .
 .
 .
}
Feralheart
  • 1,881
  • 5
  • 28
  • 59