Answered
Error Executing Database Query
I can't seem to get a simple update cfquery to work (update a
table row) without throwing an error in access. I've gone over the
code several times and don't understand why it's throwing an error.
I want a user to be able to remove themselves from a mailing list,
with having to send a reply email to do so.
<!---Who in our database has this email address--->
<cfquery name="getSubscriber" datasource="#request.datasource#" maxrows="1">
SELECT subID, Name, Email
FROM subscribers
WHERE Email= #form.Email#
AND MailingList = 1
</cfquery>
<!---Assuming someone has this email address --->
<CFIF getSubscriber.recordCount eq 0>
<!--- Update the database to remove from mailinglist--->
<cfquery datasource="#request.datasource#">
UPDATE subscribers SET
MailingList = 0
WHERE subID= #getSubscriber.subID#
</cfquery>
Here is the error that is thrown:
Error Executing Database Query. Syntax error (missing operator) in query expression 'Email= user@webserver.com AND MailingList = 1'.
*Note I've intentionally left out the <cfcatch> code since it appears to be working and catching the database error.
So,What gives, what am I doing wrong here with this query?
Thanks in advance for your help.
<!---Who in our database has this email address--->
<cfquery name="getSubscriber" datasource="#request.datasource#" maxrows="1">
SELECT subID, Name, Email
FROM subscribers
WHERE Email= #form.Email#
AND MailingList = 1
</cfquery>
<!---Assuming someone has this email address --->
<CFIF getSubscriber.recordCount eq 0>
<!--- Update the database to remove from mailinglist--->
<cfquery datasource="#request.datasource#">
UPDATE subscribers SET
MailingList = 0
WHERE subID= #getSubscriber.subID#
</cfquery>
Here is the error that is thrown:
Error Executing Database Query. Syntax error (missing operator) in query expression 'Email= user@webserver.com AND MailingList = 1'.
*Note I've intentionally left out the <cfcatch> code since it appears to be working and catching the database error.
So,What gives, what am I doing wrong here with this query?
Thanks in advance for your help.
