This should be simple enough but I'm a real newbie and could use some help.
table_a contains a list of unique_ids
table_b contains a list of unique_ids and email_address, name, message fields.
The unique_ids in table_a may or may not be the same as the unique_ids in table b.
I need a php script that I can run from a cron job that will:
enumerate through the unique_ids in table_a that have the field sent=0 and find their equal match in table_b.
If found:
mark the record in table_a as sent=1, pull the corresponding unique_id, email_address, name and message field from table_b that matched against unique_id from table_a and construct an email message from those fields and send it out the door.
If someone is quick at hand and sharp of mind perhaps they can shoot me the code I need to do this or point me in the right direction.
Thank you!
Need compare code and send email code
Moderator: General Moderators
Re: Need compare code and send email code
So is this a project you bid on that you have no clue how to complete?
Re: Need compare code and send email code
I wish, I wish that were the case and I was a good enough programmer to profit from such things. I'm a very, very new, newbie to php and trying to learn. No commercial interest here.
It's mostly the enumerating part of the query that I cannot figure out.
It's mostly the enumerating part of the query that I cannot figure out.
Re: Need compare code and send email code
Generally what we do is assist others with their code when they get stuck. If you can post what you've got and let us know where you are stuck we are happy to help.
EDIT: You're probably looking for a database query?
EDIT: You're probably looking for a database query?
Re: Need compare code and send email code
thank you!
I will post it here and see what I can come up with.
Cheers!
I will post it here and see what I can come up with.
Cheers!
Re: Need compare code and send email code
my schema/data will be:
tablea
unique_id
tableb
unique_id
name
email
message
And the following code to get the matched records. I need help with generating an email from the returned results set.
$q = mysql_query("SELECT tablea.unique_id, tableb.name, tableb.email, tableb.message FROM tablea JOIN tableb ON tablea.unique_id=tableb.unique_id;");
while($r = mysql_fetch_assoc($q)) {
//do something with the row. This contains the name, email and message. I now need to output an email message with //php
}
tablea
unique_id
tableb
unique_id
name
message
And the following code to get the matched records. I need help with generating an email from the returned results set.
$q = mysql_query("SELECT tablea.unique_id, tableb.name, tableb.email, tableb.message FROM tablea JOIN tableb ON tablea.unique_id=tableb.unique_id;");
while($r = mysql_fetch_assoc($q)) {
//do something with the row. This contains the name, email and message. I now need to output an email message with //php
}