Today we had to fix a clients PHPlist. There was an error in their mysql select statement for whatever reason – whether it was their setup (they had some really weird group names and country names) or something with PHPList. Took us a while to figure it out, but as it turns out someone else had the same issue.

Basically the fix is this:

# nano /lists/admin/send_core.php

Find this

if (is_array($_POST["criteria_values"])) {  
$values = join(", ",$_POST["criteria_values"]);  
} else {  
$values = $_POST["criteria_values"];  
}

and replace it with this

if (is_array($_POST["criteria_values"])) {  
# The following code checks for null values in the criteria_attribute array and removes them  
$values = $_POST["criteria_values"];  
foreach ($values as $key=>$value) {  
if (!$value) {  
array_splice($values, $key, 1); // Remove null value from array  
}  
}  
$values = join(", ",$values);  
# $values = join(", ",$_POST["criteria_values"]);  
} else {  
$values = $_POST["criteria_values"];  
}

Now everything should work, with no more mysql errors!