How to count rows in Nette Database?
Notice: This thread is very old.
- alfanumeric
- Member | 2
Hello, how can I get number of results from query?
$q = $this->database->query('SELECT * FROM post WHERE ID = ?', $id);
I don't understand your API but I found only this:
$q->count
Cannot read an undeclared property Nette\Database\ResultSet::$count.
And
count($q)
= 1 all times.
Last edited by alfanumeric (2015-07-05 21:17)
- mrtnzlml
- Member | 140
Yes, it is: https://api.nette.org/…sultSet.html#…. This API should be more important for you.
- Šaman
- Member | 2661
There are Nette\Database\Table\Selection
and Nette\Database\ResultSet
Most of examples show rich Nette\Database\Table
, but you use simple
query and that function returns
ResultSet
.