I am using PDO to retrieve data from php. I am trying to use limit function but sadly it did not work. I searched around the forum for similar questions and found answers similar to what I tried below. But I get the same warning. I am relatively new to PDO. Am I doing something wrong?
$limit = 5;
$users = $db->prepare("SELECT code,name from Portion where name LIKE '%$t%' LIMIT :limit");
$users->bindParam(':limit', $limit, PDO::PARAM_INT);
$users->execute(['query' => "{$_GET['query']}%"]);