Unable to get all entries of a table

Hi, I am trying to pick a list with all entries from a db table by using

$sql = 'SELECT * FROM *PREFIX*owncollab_timetracker_clients'; return $this->findEntity($sql);.

But this throws following error:

Exception: {"Exception":"OCP\\AppFramework\\Db\\MultipleObjectsReturnedException","Message":"Did not expect more than one result when executing: query \"SELECT * FROM *PREFIX*owncollab_timetracker_clients\"; parameters Array\n(\n)\n; limit \"\"; offset \"\"","Code":0,

What am I doing wrong?

Andy

you should check findEntities() !

1 Like

Is findentity really what you want to use?
You are selecting multiple values and need to process them

stmt = $this->db->prepareQuery($SQL);
$result = $stmt->execute(array(...));
while( $row = $result->fetchRow()) {....

Let me know…

@Cult: Thanks! That was the trick