I have this function in a class where I have a condition that as an int param, without the contion where the query return corretly, but it this contiton it return the following error:
[Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Incorrect syntax near '@P1'
function view_count_eventos(){
$year=date('Y');
try {
$SQL = 'SELECT Count(*)
FROM [tablename] as j
left join [tablename] as j1
ON j.No_ = j1.No_
where [Starting Date] like CONCAT('."%".':year'."%".')';
$result = parent::connect()->prepare($SQL);
$result->bindParam(':year', $year, PDO::PARAM_INT);
$result->execute();
$rs=$result->fetch();
return $rs;
} catch (Exception $e) {
die('Error Administrator(view_eventos) '.$e->getMessage());
} finally{
$result = null;
}
}