Home > Mail, Technical > Fixing MySQL Error 1064 with PHPList when selecting new criteria

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)

Categories: Mail, Technical Tags:
  1. bousquet
    April 6th, 2009 at 10:31 | #1

    thanks a lot. You saved me time with this fix. I’ve version 2.10.9 and the bug is still there.

  2. TC
    April 25th, 2009 at 02:50 | #2

    You rock!

  3. Mohammad Al-Shami
    April 25th, 2009 at 09:46 | #3

    Thanks for the comments guys, glad I helped :)

  4. April 28th, 2009 at 10:33 | #4

    Exactly what I needed, cheers!

  5. NU
    May 8th, 2009 at 15:01 | #5

    Thanks!!!

  6. September 14th, 2009 at 11:42 | #6

    Thanks dude !! this help me a lot!

  7. November 24th, 2009 at 23:03 | #7

    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

  8. Mohammad Al-Shami
    December 2nd, 2009 at 08:40 | #8

    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

  9. kepake
    May 16th, 2010 at 19:01 | #9

    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.

  10. Mohammad Al-Shami
    June 19th, 2010 at 12:37 | #10

    Sorry I didn’t notice your comment before. Also I don’t speak Spanish. Can you ask your question in English please?

  1. No trackbacks yet.