here my code :
$Limit=5;
$sql = 'SELECT * FROM [dbo].[table_name] ORDER BY [count] DESC LIMIT :limit';
$stmt = $db->prepare($sql);
$stmt->bindValue(':limit', (int) $Limit, PDO::PARAM_INT);
$results = $stmt->execute();
and here the error im getting :
Fatal error: Uncaught PDOException: SQLSTATE[HY090]: Invalid string or buffer length: [FreeTDS][SQL Server]Invalid string or buffer length
Any idea what im doing wrong?
LIMIT :limit
?PDO::ATTR_EMULATE_PREPARES
option explicitly?$db->setAttr(PDO::ATTR_EMULATE_PREPARES, true);