I have the following bit of code that fetches results from a query.
$sql =
"
SELECT 1 AS bar
FROM outsource.prodgroup_division
WHERE
(
CASE
WHEN :division = 'ALL' THEN 1
WHEN prodgroup_division.division = :division THEN 1
ELSE 0
END
) = 1
";
$stmt = $dw_db->prepare($sql);
$stmt->bindParam(':division', $division, 2); // 2 for strings
$stmt->execute();
$rows = $stmt->fetchAll();
$stmt->closeCursor();
My division parameter is set to 'ALL'. When I run it without the parameters and hardcode in 'ALL' it gives me 22 rows. Why am I getting zero data in my $rows array?