I am trying to do a query setting in the sql the limit and the offset
But all the time I get this error
SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''20' OFFSET '0'' at line 8
Here is my code, any idea?
$conn = new PDO("mysql:host=".DB_HOST.";dbname=".DB_DB, DB_USER, DB_PASSWORD);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$conn->exec("set names utf8"); //BECAUSE I NEED TO WORK WITH CHINESE LANGUAGE
$limit = 20;
$offset = 0;
$params = array(':limit'=>$limit,':offset'=>$offset);
$stmt = $conn->prepare('
SELECT
*
FROM
dc_user
WHERE
user_status != 0
LIMIT
:limit
OFFSET
:offset
');
$stmt->execute($params);