I have a database with emails of my site members and i'd like to send them an HTML newsletter every week.
The problem is that the body of the email must be created automatically by running some other queries and i'm getting a "nested query" error.
Let's say i've got a query that gathers all the members and emails and i'm using it with cfmail "batch" send the email to all these folks:
<CFQUERY Name="Member" Datasource="mydsn">
SELECT MemberPassword
FROM Members
WHERE MemberEmail='#MemberEmail#' AND MemberPassword='#MemberPassword#'
</CFQUERY>
and another query that get's some other infos (news):
<CFQUERY Name="MyNews" Datasource="mydsn">
SELECT newID, new, newdate
ROM codenews
WHERE code_new_date BETWEEN #now()# AND #DateAdd('D', -5, Now())#
ORDER BY code_new_date DESC
</CFQUERY>
When i need to send the newsletter i have:
<cfmail query="Members" to="#MemberEmail#" from="#mymail#" subject="" type="HTML">
BUT HERE I MUST HAVE THE RESULTS OF THE OTHER QUERY MYNEWS
IF I MAKE AN OUTPUT I"VE GOT A NESTED ERROR
Example:
<cfoutput query="MyNews">
(#newdate#) #new#
</cfoutput>
</cfmail>
How can i avoid this?
Thanx in advance i know someone has a question for this one!
Dimitris
The problem is that the body of the email must be created automatically by running some other queries and i'm getting a "nested query" error.
Let's say i've got a query that gathers all the members and emails and i'm using it with cfmail "batch" send the email to all these folks:
<CFQUERY Name="Member" Datasource="mydsn">
SELECT MemberPassword
FROM Members
WHERE MemberEmail='#MemberEmail#' AND MemberPassword='#MemberPassword#'
</CFQUERY>
and another query that get's some other infos (news):
<CFQUERY Name="MyNews" Datasource="mydsn">
SELECT newID, new, newdate
ROM codenews
WHERE code_new_date BETWEEN #now()# AND #DateAdd('D', -5, Now())#
ORDER BY code_new_date DESC
</CFQUERY>
When i need to send the newsletter i have:
<cfmail query="Members" to="#MemberEmail#" from="#mymail#" subject="" type="HTML">
BUT HERE I MUST HAVE THE RESULTS OF THE OTHER QUERY MYNEWS
IF I MAKE AN OUTPUT I"VE GOT A NESTED ERROR
Example:
<cfoutput query="MyNews">
(#newdate#) #new#
</cfoutput>
</cfmail>
How can i avoid this?
Thanx in advance i know someone has a question for this one!
Dimitris