Board index   FAQ   Search  
Register  Login
Board index php forum :: Database mySQL & php coding

PHP Runner Mail Code

Codes here !

Moderators: macek, egami, gesf

PHP Runner Mail Code

Postby Rapacious » Thu Jul 26, 2012 8:56 am

I have a page that sends e-mails based on a date field changing. At first when I only had the 1 e-mail action, if the field PP_S2_Date changed, then an e-mail went. So I added if either of the dates change, and now I get 2 e-mails sent every time someone saves the record whether a change to those fields occurred or not. I'm new to PHP and SQL, and I'm trying to begin my education on them. ie i just bought Learning PHP & MySQL, Second Edition by O'Reilly so please be a little patient with me =] Below is the code that I have that is not working. I just had the single code with the 1 e-mail command, and I'm trying to add the 2nd. All help is greatly appreciated

if ($oldvalues["PP_S2_DATE"] != $values["PP_S2_DATE"]) {
// ********** Send simple email ************
$email="jbarreras@srdcommercial.com";
$from="contact@saundersrealestate.com";
$msg="Please begin to process the ".$values["Marketing Title"]." listing. ".$values["Listing Agent"]." has completed the Listing Inofrmation Sheet and the project is now ready to begin the marketing process";
$subject="New Listing: ".$values["Marketing Title"];
$ret=runner_mail(array('to' => $email, 'subject' => $subject, 'body' => $msg, 'from'=>$from));
if(!$ret["mailed"])
echo $ret["message"];


if ($oldvalues["PP_S35_DATE"] != $values["PP_S35_DATE"]) {
// ********** Send simple email ************
$email="jbarreras@srdcommercial.com";
$from="contact@saundersrealestate.com";
$msg="Price Change ".$values["Marketing Title"]." listing. ".$values["Listing Agent"]." has updated the price. Please begin the Price Change Protocol";
$subject="Price Change: ".$values["Marketing Title"];
$ret=runner_mail(array('to' => $email, 'subject' => $subject, 'body' => $msg, 'from'=>$from));
if(!$ret["mailed"])
echo $ret["message"];
}}
Rapacious
New php-forum User
New php-forum User
 
Posts: 4
Joined: Thu Jul 26, 2012 8:51 am

Re: PHP Runner Mail Code

Postby johnj » Thu Jul 26, 2012 8:08 pm

try this
Code: Select all
if ($oldvalues["PP_S2_DATE"] != $values["PP_S2_DATE"])
{
}
elseif ($oldvalues["PP_S35_DATE"] != $values["PP_S35_DATE"])
{
}

johnj
php-forum Super User
php-forum Super User
 
Posts: 1805
Joined: Thu Mar 10, 2011 5:07 pm

Re: PHP Runner Mail Code

Postby Rapacious » Fri Jul 27, 2012 4:19 am

with the elseif command added, The first "if" statement e-mail code works, but the elseif does not. When I update the PP_S35_DATE, an e-mail does not get sent.
Rapacious
New php-forum User
New php-forum User
 
Posts: 4
Joined: Thu Jul 26, 2012 8:51 am

Re: PHP Runner Mail Code

Postby johnj » Fri Jul 27, 2012 5:31 am

then, use two separate ifs.
johnj
php-forum Super User
php-forum Super User
 
Posts: 1805
Joined: Thu Mar 10, 2011 5:07 pm

Re: PHP Runner Mail Code

Postby Rapacious » Fri Jul 27, 2012 10:31 am

I went ahead and separated the if statements with {} and still no luck. I may just need to contact PHP Runner and pay the hourly rate just for them to tell me the syntax their system likes best.
Rapacious
New php-forum User
New php-forum User
 
Posts: 4
Joined: Thu Jul 26, 2012 8:51 am

Re: PHP Runner Mail Code

Postby johnj » Sat Jul 28, 2012 7:53 am

try this
Code: Select all
if (($oldvalues["PP_S2_DATE"] != $values["PP_S2_DATE"]) ||  ($oldvalues["PP_S35_DATE"] != $values["PP_S35_DATE"]))
{
}


You need to be clear about what you want.
johnj
php-forum Super User
php-forum Super User
 
Posts: 1805
Joined: Thu Mar 10, 2011 5:07 pm

Re: PHP Runner Mail Code

Postby Rapacious » Mon Jul 30, 2012 4:22 am

I really appreciate the help johnj. I'm sorry if I'm not getting my question across clearly. I will try again. I'm trying to write a line of code that will send an e-mail when a certain field is updated. I can get it to work when I have 1 of the codes in. When I add the 2nd code, I'm having trouble. I'm not sure what the proper syntax is to get what I need accomplished. I'm NOT trying to send an e-mail with the same message if either of the fields is changed. I want to send a different message depending on which field is updated. if PP_S2_DATE is updated, I want to send a message stating it's updated. If PP_S35_DATE is updated, I want to send a different message stating it's updated.

So, I have been using the code below for the past 6 months and it's been working splendidly, but when I try and add an additional line of code to send a different message I get weird results.

if ($oldvalues["PP_S2_DATE"] != $values["PP_S2_DATE"]) {
// ********** Send simple email ************
$email="jbarreras@srdcommercial.com";
$from="contact@saundersrealestate.com";
$msg="Please begin to process the ".$values["Marketing Title"]." listing. ".$values["Listing Agent"]." has completed the Listing Inofrmation Sheet and the project is now ready to begin the marketing process";
$subject="New Listing: ".$values["Marketing Title"];
$ret=runner_mail(array('to' => $email, 'subject' => $subject, 'body' => $msg, 'from'=>$from));
if(!$ret["mailed"])
echo $ret["message"];
}
Rapacious
New php-forum User
New php-forum User
 
Posts: 4
Joined: Thu Jul 26, 2012 8:51 am


Return to mySQL & php coding

Who is online

Users browsing this forum: Yahoo [Bot] and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron