Forums

Error mysql

webcrea 20 Sep, 2018
Hello,

In this case, if you don't select the first 4 input the mysql WHERE start with AND and produces an error.
Do you know how can i do to solve this issue?

fonds.notreSelection:{data:notre_selection}/-
fonds.published:{data:cbox_published}/-
fonds.sg_id:{data:select_sg}/-
fonds.millesime:{data:select_mille}/-
AND
(
fonds.natureProduit:{data:select_type}
OR
fonds.natureProduit1:{data:select_type}
OR
fonds.natureProduit2:{data:select_type}
)

Thanks
Regards
healyhatman 20 Sep, 2018
1 Likes
Pretty sure there's an implicit AND between each line, just get rid of the AND
webcrea 20 Sep, 2018
Thanks
You're right
webcrea 20 Sep, 2018
but this
programs.id:{data:programs_list}/-
providers.id:{data:providers_list}/-
sessions.id:{data:sessions_list}/-
(
enrollments.student_first_name:{data:search}/-
OR
enrollments.student_last_name:{data:search}/-
OR
enrollments.student_email:{data:search}/-
)

produces this error if nothing in search

​[h1]1064[/h1][h2]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 'OR OR )' at
line 1 [/h2]

And this without /-

programs.id:{data:programs_list}/-
providers.id:{data:providers_list}/-
sessions.id:{data:sessions_list}/-
(
enrollments.student_first_name:{data:search}
OR
enrollments.student_last_name:{data:search}
OR
enrollments.student_email:{data:search}
)
Show only empty fields
healyhatman 20 Sep, 2018
Put /- after the closing bracket
webcrea 20 Sep, 2018
[h1]1054[/h1][h2]Unknown column 'enrollments.(' in 'where clause' [/h2]
healyhatman 20 Sep, 2018
)/- like that. Get rid of the /- after the {data:search}
This topic is locked and no more replies can be posted.