Fixing MySQL Error 1064 with PHPList when selecting new criteria
I’m currently experimenting with PHPlist to use for our corporate newsletters. During the tests I got the following error
Database error 1064 while doing query You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘1)’ at line 3
Tracking this problem down I found the following code segment in “admin/send_core.php”
if (is_array($_POST["criteria_values"])) {
$values = join(", ",$_POST["criteria_values"]);
} else {
$values = $_POST["criteria_values"];
}
$values in this segment will always start with a comma. We just need to add a substr statement to fix that. Just change it to
if (is_array($_POST["criteria_values"])) {
$values = join(", ",$_POST["criteria_values"]);
} else {
$values = $_POST["criteria_values"];
}
if (substr($values, 0, 1) == ",") {
$values = substr($values, 1);
}
That’s it. This will remove the starting comma (If it exists)



thanks a lot. You saved me time with this fix. I’ve version 2.10.9 and the bug is still there.
You rock!
Thanks for the comments guys, glad I helped
Exactly what I needed, cheers!
Thanks!!!
Thanks dude !! this help me a lot!
Hi Shami,
I have a similar problem and the same error message except that it happens when I import, or when I send a test .
I have crteria added, but I ma not using any of them to select.
It complains of :
1064 while doing query You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘) and phplist_user_user_attribute.attributeid = 15′
I looked in this table and there is no attributeid number 15 the highes is 11.
any ideas
ny suggestions would be really appreciated
Hi EDT.
Sadly I’ve only installed PHPlist once and didn’t run into your error. I think this question will be answered better in the PHPlist forums/mailing lists.
Have a great day
Gracias por la información. Yo tengo PHPLIST 2.10.12. Parece que el error no es nuevo. No entiendo por que no se ha solucionado ya ???
Lo dicho gracias por la corrección. De verdad que la necesitaba.
Sorry I didn’t notice your comment before. Also I don’t speak Spanish. Can you ask your question in English please?