I
I
Ivan Ivanovich2019-12-02 13:54:54
PHP
Ivan Ivanovich, 2019-12-02 13:54:54

How to add a limit?

Hello.
Please tell me how to this request

return $db->query('SELECT * FROM `' . static::getTableName() . '` ORDER BY `views`', [':views' => $views], static::class);

add limit?
I just know that you can turn off the emulation mode, or if you bind. But on simple examples it’s clear, but on more complex ones like this one, I don’t understand. Or is there some other easier way?
Tell me please.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
VicTHOR, 2019-12-02
@IwanQ

$db->query('SELECT * FROM `' . static::getTableName() . '` ORDER BY `views` LIMIT 10', [':views' => $views], static::class);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question