Page 1 of 1

1 Replies - 2425 Views - Last Post: 18 June 2005 - 08:12 AM Rate Topic: -----

#1 jspidy  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 11
  • Joined: 25-February 05


Posted 18 June 2005 - 07:31 AM

im using cfmail to send a confirmation email after a user as completed the registration form the problem iam haveing is sending the message to the person who has created the account.
It just sends the message to everyone in my database the code iam using is as follows

<!-- sql select statement for userdetial start -->
<cfquery name="mail_call_send" datasource="register" password="19mp9x4" username="administrator">
FROM reguser</cfquery>
<!-- sql select statement for userdetial end -->

<!-- sql select statement for carregdetails starts -->
<cfquery name="mail_call_send_1" datasource="register" password="19mp9x4" username="administrator">
FROM usercar</cfquery>

<!--Confirmation Email start -->
<cfmail query="mail_call_send"
from="[email protected]"
subject="Your Registration Detials">
<!-- find a way to fetch the email just added to the database through the registration form -->

Please help :angry: its doin my head in :angry:
cheers jay

Is This A Good Question/Topic? 0
  • +

Replies To: email

#2 Amadeus  Icon User is offline

  • g+ + -o drink whiskey.cpp
  • member icon

Reputation: 250
  • View blog
  • Posts: 13,507
  • Joined: 12-July 02

Re: email

Posted 18 June 2005 - 08:12 AM

In your queries, you are selecting all users in the need to select only the one that was just added. I assume that you have some sort of primary key attached to each user, a value that is unique to that user (people often use a number or combination of other fields for this purpose). You can use that identifier to grab the correct user, making you query something like
SELECT * FROM reguser WHERE youridcolumn = userid

The actual userid you can obtain in a myriad of ways...return it to variable after you insert the record, use the count of all records in the table (assuming that your values are ordered), place a special query to get the last inserted record (this will vary depending on what database you are using...some dbs support the last you can just grab the email from the last record, but it is more universal to order your records by primary key and take the max value, or especially a timestamp - assuming that you are timestampint the records).
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1