A wee little question from Ireland

Results 1 to 4 of 4

Thread: A wee little question from Ireland

  1. #1
    Leprechaun Guest

    Default A wee little question from Ireland

    Hi,<BR><BR>I&#039ve just updated my mailing list application. The visitor enters info. such as Name, address, Country and email address. These are sent to TableA in a database. I get lots of visitors from different country&#039s and want to be able to send different Newsletters for different Coiuntry&#039s. I&#039ve created an ADMIN page using ASP where I can send an email using SMTP to all of the email address&#039 in TableA. I would like to have either radio buttons with different country&#039s specified or a drop down list, so i can decide which country to sen the newsletter to.<BR><BR>To do this, I want to be able to move lets say All Email address&#039 relevant to Ireland into TableB, send the message to these email address&#039 and then delete the contents of TableB so it can be used again for another country. <BR><BR>Can anybody please help. This is driving me crazy.<BR><BR>Thanks

  2. #2
    Scott S Guest

    Default RE: A wee little question from Ireland

    Why not just query on what the users enter for the country? <BR><BR>SELECT DISTINCT COUNTRY FROM TABLEA will return just a list of the various countries with out duplciate records. <BR><BR>perhaps assign these countries to radio buttons or a dropdown list as you mentioned. Then when you specify what you want to send & pick one or more of the countries, issue the query: <BR><BR>Select emailaddress from tableA where country in (TargetCountryONe, TargetCountryTwo) <BR><BR>Then you have your list of email addresses to send things to, you can specify which countries get what email. There&#039s no need for a separate table here, if you are collecting where users are from (country) then thats all you need. How does this sound?<BR><BR>Hope this helps<BR><BR>Scott S

  3. #3
    leprechaun Guest

    Default RE: A wee little question from Ireland

    Thanks Sott,<BR><BR>This helps me an awful lot but i&#039m not too familiar with SQL. Would you know the code for the sql statement you suggested or would you be able to point me to a site where I could get more information.<BR><BR>Thanks

  4. #4
    Scott S Guest

    Default RE: A wee little question from Ireland

    Assuming that our table looks something like this: <BR><BR>TABLE tbl_MailingList_users <BR>USERID INT<BR>USERNAME VARCHAR(200) -- Just a datatype <BR>USEREMAIL VARCHAR(200) <BR>USERCOUNTRY VARCHAR(200) <BR><BR>Assuming the table looks something like that (obviously sub in your own field names) <BR><BR>To get a List of each country in the table without duplicate records (ie if our table had 2 countries: USA was listed 47 Times for 47 users, and Ireland was listed 83 Times for 83 users, I would want to recieve a list of: USA, IRELAND and thats it.) <BR><BR>Heres the code: <BR> SELECT DISTINCT USERCOUNTRY FROM TBL_MAILINGLIST_USER<BR>-- Notice the Distinct, that is what prevents us from getting all the records back.<BR><BR>Once you have the country(s) that you want to send mail to, you can issue the following statement:<BR><BR>SELECT USEREMAIL FROM TBL_MAILINGLIST_USERS WHERE USERCOUNTRY IN <BR>(USA, IRELAND) <BR><BR>-- Just list them out like in a list like that, its that simple. <BR><BR>Does this help? the syntax is all exact, it will work (should work) I didnt put any psuedo code in & I&#039ve used all of these on MS SQL Server (but they should work for any database.)<BR><BR>hope this helps<BR><BR>Scott S<BR>ssargent@epotec.com<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts