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)
Mohammad H. Al-Shami. Email and DNS security specialist, ex-code monkey, and bad swimmer
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?
Hi,
Many thanks for the fix. I had been searching in phplist’s forums but didn’t find any solution which solved this issue, on 2.10.12.
Your fix worked for me.
Did you post at their forum as well?
Cheers
No I didn’t, it didn’t occur to me
i hve prob ni doing mysql stored procedure…
create procedure comparedata()
begin
declare acolumn1 varchar(100);
declare acolumn2 varchar(100);
|
|
v
end;
the error is :
#1064 – 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 ” at line 3
–> can u help me to fix this error?
Sadly I haven’t worked on PHPlist for almost a year, the article is most probably outdated now. Sorry
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 ‘text/css”> body { font-size : 11px; font-family: Verdana, Arial, Helvetica, s’ at line 1
Found this issue when click on configure.
Sorry for the late reply.
Well the post itself is very old, and sadly I haven’t used the software in a while, so I haven’t updated it.