From 3f97e7b1f067aa21eed492b22a3e7219e9c603a8 Mon Sep 17 00:00:00 2001 From: Victor Westerlund Date: Sun, 31 Dec 2023 17:33:59 +0100 Subject: [PATCH] fix: filter column value null in where method (#26) --- src/MySQL.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/MySQL.php b/src/MySQL.php index b88f6c3..2776854 100644 --- a/src/MySQL.php +++ b/src/MySQL.php @@ -91,6 +91,12 @@ continue; } + // Value is null so it does not need to be added to the prepared statement + if (is_null($value)) { + $filter[] = "`{$col}` IS NULL"; + continue; + } + // Create SQL for prepared statement $filter[] = "`{$col}` = ?"; // Append value to array with all other values