jeddi
03-16-2009, 12:02 PM
What is the best way to write the while loops
for this:
I have a MySQL table of clients that I want to send a series of 5 emails
after they sign up.
The clients are in 2 groups and they'll get two different sets of emails.
So my table is like this:
cl_name | group | eml_cnt | email_add | other stuff ...
Dave | A | 0 | Dave@email_add.com | other stuf
Stev | A | 3 | Stev@email_add.com | other stuf
John | B | 0 | John@email_add.com | other stuf
Pete | A | 1 | Pete@email_add.com | other stuf
Jeffe | B | 2 | Jeffe@email_add.com | other stuf
Jacky| A | 4 | Jacky@email_add.com | other stuf
I will run the script every 2 days and it needs to
send:
messageA1.txt to group A who are at count 0
messageA2.txt to group A who are at count 1
messageA3.txt to group A who are at count 2
messageA4.txt to group A who are at count 3
messageA5.txt to group A who are at count 4
and
messageB1.txt to group B who are at count 0
messageB2.txt to group B who are at count 1
messageB3.txt to group B who are at count 2
messageB4.txt to group B who are at count 3
messageB5.txt to group B who are at count 4
Should I index the table ? if so with which key ?
As the message is sent the eml_cnt field needs to be
incremented by one.
I am a bit lost about how to do the logic for the
while or for loops :o
So if anyone can help me out, I'd appreciate it :)
for this:
I have a MySQL table of clients that I want to send a series of 5 emails
after they sign up.
The clients are in 2 groups and they'll get two different sets of emails.
So my table is like this:
cl_name | group | eml_cnt | email_add | other stuff ...
Dave | A | 0 | Dave@email_add.com | other stuf
Stev | A | 3 | Stev@email_add.com | other stuf
John | B | 0 | John@email_add.com | other stuf
Pete | A | 1 | Pete@email_add.com | other stuf
Jeffe | B | 2 | Jeffe@email_add.com | other stuf
Jacky| A | 4 | Jacky@email_add.com | other stuf
I will run the script every 2 days and it needs to
send:
messageA1.txt to group A who are at count 0
messageA2.txt to group A who are at count 1
messageA3.txt to group A who are at count 2
messageA4.txt to group A who are at count 3
messageA5.txt to group A who are at count 4
and
messageB1.txt to group B who are at count 0
messageB2.txt to group B who are at count 1
messageB3.txt to group B who are at count 2
messageB4.txt to group B who are at count 3
messageB5.txt to group B who are at count 4
Should I index the table ? if so with which key ?
As the message is sent the eml_cnt field needs to be
incremented by one.
I am a bit lost about how to do the logic for the
while or for loops :o
So if anyone can help me out, I'd appreciate it :)