[Solved] PDO states I am missing tokens, But I am not – what’s wrong with this [closed]


You are setting the query before you add the filter to the query string.

// Get the results from the query
$query->setQuery($sqlSelect)
    ->setParameter('startMonth', $startMonth)
    ->setParameter('endMonth', $endMonth);

if (!empty($filter)) {
    $sqlSelect .= 'AND LOG.VALUE LIKE :filter ';
    $query->setParameter('filter', '%'.$filter.'%');
}

You are setting the query to $sqlSelect and aftwards appending the filter part after setting the query but never setting the query again to the new value.

1

solved PDO states I am missing tokens, But I am not – what’s wrong with this [closed]