Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7025245
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T23:56:55+00:00 2026-05-27T23:56:55+00:00

I have a table called ‘sample’ with fields as ‘sample_id, ‘order_id’, order_email_id’, ‘review_request’, ‘coupon_sent’.

  • 0

I have a table called ‘sample’ with fields as ‘sample_id, ‘order_id’, order_email_id’, ‘review_request’, ‘coupon_sent’.

$to_date = date('Y-m-d H:i:s',strtotime('-1 days'));
        $orders = Mage::getModel('sales/order')->getCollection()->addFieldToFilter('status', 'complete')->addFieldToFilter('updated_at',array('to' => $to_date ))->addAttributeToSelect('customer_email')->addAttributeToSelect('entity_id');
        foreach ($orders as $order) 
        {
            $email = $order->getCustomerEmail();
            $id = $order->getEntityId();
            //echo 'Email: ' . $email . ' Id: ' .$id .'<br/>' ;     
            $sample = Mage::getModel('sample/sample');
            $sample->setOrderId($id);
            $sample->setOrderEmailId($email);
            $sample->save();
            echo '<br/>Record Added';

        }

        $posts = Mage::getModel('sample/sample')->getCollection();
        foreach($posts as $sample_post)
        {
            if($sample_post->getReviewRequest()==0)
            {
                     code to send email to email id's from this table's order_email_id field
                    try
                    {
                       (if($mail->send() == true)
           { 
            echo "<br> Mail Sent ";
                       //**WHERE clause condition to update 'review_request' field for all successful emails sent**

                      }
                      else {echo 'Mail not Sent';}
                   }
                   catch(Exception e) {}

So acc to my code how do I put the WHERE clause which sets review_request = 1 for all the records where the emails have been sent successfully.

Thanks in advance

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T23:56:55+00:00Added an answer on May 27, 2026 at 11:56 pm

    Thanks @clockworkgeek for bringing that link again and downvoting which ‘probed’ me even further to work out the solution. 😛 I think I found it.

     if($mail->send() == true)
     { 
         echo "<br> Mail Sent ";
     $model1 = Mage::getModel('sample/sample')->getCollection();
                $model1->load()->addFieldToFilter('order_email_id',array('eq' => $toEmail))->getSelect());
    foreach($model1 as $final_model)
    { 
           $final_model->setReviewRequest(1)->save();
        }
     }
    

    And this perfectly updates my table with all the records where the emails were sent with review_request = 1
    Thanks.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table called employee with following fields Id | Name | PrimaryEmail1
I have a table called tblIssueTicket tblIssueTicket contains the fields: TicketID, TicketRequesterID, ApprovalManagerID, RequestDate,
I have a table called link_track with the following fields: id, uid, ip, hitdate
I have table called comments with following structure: id | entry_id | date |
I have a db table called Calendar with fields Id (PK) Name Description CalendarTypeId
I have table called stats . In am inserting yes or no in the
I have a table called OffDays, where weekends and holiday dates are kept. I
I have a Table called Product and I have the Table StorageHistory . Now,
I have a table called ApprovalTasks... Approvals has a status column I also have
I have a table called BlogPost which has a 1-to-many relationship with the Comment

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.