3 posts by 2 authors in: Forums > CMS Builder
Last Post: March 31, 2014   (RSS)

Hi Terry,

So you're getting the system to e-mail you a list of all of the new records, but you're unsure how to store a list of the new records in one large string to e-mail? I think something like this should work:

  //Create the empty message variable
  $message = "";

  //Get the date from yesterday in mysql format
  $yesterdayDate = date('Y-m-d 00:00:00', strtotime('-1 day'));

  //Get all of the records created since yesterday
  $newRecords = mysql_select('cars', "`createdDate` > '".$yesterdayDate."'");


  //Cycle through the new records
  foreach($newRecords as $record){
    //Add each cars name to the message string
    $message .= "{$record['title']}\r\n";
  }

Hopefully the notes I've added to the code will explain what is happening at each step. So by using $message .= I'm adding each new record title to the variable on each loop through.

Cheers!

Greg

Greg Thomas
PHP Programmer - interactivetools.com

By terryally - March 31, 2014

Hi Greg,

Thanks for your response and apology for the late reply.

This code works well.

Thanks again.

Terry