I have the following two tables, that match against each other.
(This system has to be an automatic notifier by e-mail when someones search-criteria in the database matches with the data of vehicles that are for sale).
Example:
So in this example, there should be an e-mail send to "email@email.com", with the details of the car: BMW 520 from the table "Test".
This is the SQL-statement I use:
Code:
--------------------------------------------------------------------------------
SELECT Test.Model, Test.Type, Login.Models, Login.Types, Login.Minlength,
Login.Maxlength, Test.Loa, Test.Asking_price, Login.Minprice, Login.Maxprice,
Test.Hull_Material, Login.Material, Login.Email
FROM Test, Login
WHERE Test.Model LIKE Login.Models AND Test.Type = Login.Types AND Test.Loa
BETWEEN Login.Minlength AND Login.Maxlength AND Test.Asking_price BETWEEN
Login.Minprice AND Login.Maxprice AND Test.Hull_Material = Login.Material
ORDER BY Test.Model
--------------------------------------------------------------------------------
This query returns me all matching data in the following way:
So in the above example there are 3 BMW's for sale. The person is searching for a BMW, so it returns 3 matches. (is this right ???)
Then the results are mailed to each person, that has a match
Code:
--------------------------------------------------------------------------------
<%
While ((Repeat1__numRows <> 0) AND (NOT rsSearch.EOF))
%>
<tr>
<td><%=(rsSearch.Fields.Item("Model"
.Value)%></td>
<td><%=(rsSearch.Fields.Item("Type"
.Value)%></td>
<td><%=(rsSearch.Fields.Item("Asking_price"
.Value)%></td>
</tr>
<%
Set mail = Server.CreateObject("CDONTS.NewMail"
mail.From = "info@mijnsite.nl"
mail.To = rsSearch("Email"
mail.BodyFormat = 0
mail.MailFormat = 0
mail.Subject = "subject"
mail.Body = rsSearch("Model"
& rsSearch("Type"
& rsSearch("Asking_price"
mail.Send
Set mail = Nothing
%>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
rsSearch.MoveNext()
Wend
%>
--------------------------------------------------------------------------------
But, now for each match there is an e-mail send to that person, with the details of the car for sale.
I want offcourse that when there is a match, that there is one e-mail send to each person, with all the matches in the bodytext of the email.
How can I achieve this ?
Is my SQL right, I'm worried that that is the problem, is that correct ?
(This system has to be an automatic notifier by e-mail when someones search-criteria in the database matches with the data of vehicles that are for sale).
Example:
Code:
Test.Model Test.Type
BMW 316
Mercedes SLK
Opel Tigra
Opel Calibra
BMW 520
Login.Models Login.Types Login.Email
BMW 520 email@email.com
Opel Astra jansen@jansen.com
This is the SQL-statement I use:
Code:
--------------------------------------------------------------------------------
SELECT Test.Model, Test.Type, Login.Models, Login.Types, Login.Minlength,
Login.Maxlength, Test.Loa, Test.Asking_price, Login.Minprice, Login.Maxprice,
Test.Hull_Material, Login.Material, Login.Email
FROM Test, Login
WHERE Test.Model LIKE Login.Models AND Test.Type = Login.Types AND Test.Loa
BETWEEN Login.Minlength AND Login.Maxlength AND Test.Asking_price BETWEEN
Login.Minprice AND Login.Maxprice AND Test.Hull_Material = Login.Material
ORDER BY Test.Model
--------------------------------------------------------------------------------
This query returns me all matching data in the following way:
Code:
Test.Model Login.Models Login.Email
BMW BMW email@email.com
BMW BMW email@email.com
BMW BMW email@email.com
Then the results are mailed to each person, that has a match
Code:
--------------------------------------------------------------------------------
<%
While ((Repeat1__numRows <> 0) AND (NOT rsSearch.EOF))
%>
<tr>
<td><%=(rsSearch.Fields.Item("Model"
<td><%=(rsSearch.Fields.Item("Type"
<td><%=(rsSearch.Fields.Item("Asking_price"
</tr>
<%
Set mail = Server.CreateObject("CDONTS.NewMail"
mail.From = "info@mijnsite.nl"
mail.To = rsSearch("Email"
mail.BodyFormat = 0
mail.MailFormat = 0
mail.Subject = "subject"
mail.Body = rsSearch("Model"
mail.Send
Set mail = Nothing
%>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
rsSearch.MoveNext()
Wend
%>
--------------------------------------------------------------------------------
But, now for each match there is an e-mail send to that person, with the details of the car for sale.
I want offcourse that when there is a match, that there is one e-mail send to each person, with all the matches in the bodytext of the email.
How can I achieve this ?
Is my SQL right, I'm worried that that is the problem, is that correct ?