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 7879685
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T03:57:22+00:00 2026-06-03T03:57:22+00:00

I have a reminder mail sent to those who do not log on to

  • 0

I have a reminder mail sent to those who do not log on to my site after 30 days. Earlier I got an answer on this forum to create a seperate field and then update it as mentioned here: Need help on unix time stamp.

I have created a new field lastprelogin, now how do I update the respective field when I send the mail for inactive users.

<?php
include("include/data.php");
$query = "SELECT * FROM myusers WHERE DATE_ADD(FROM_UNIXTIME(lastprelogin), INTERVAL 15 DAY) < CURDATE()";
$result = mysql_query($query);
$num = mysql_numrows($result);
$i = 0;
while ($i < $num)
{
    //send mail code
    $sendmail = mail($to,$subject,$msg,$headers);
    $i++;
    if($sendmail) {
        $query1 = "UPDATE myusers SET lastprelogin='".time()."'";
        $result2 = mysql_query($query1);
    }
}
?>

How can I update the respective user’s lastprelogin field after sending the mail?

I am lost here beccause am unable to understand the logic in this part.

  • 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-06-03T03:57:24+00:00Added an answer on June 3, 2026 at 3:57 am

    The logic of Your script is simple:

    • retrieve all the users that didn’t log in for last 15 days
    • send an email to each user
    • and if that succeeds also update the field lastprelogin for that user

    You have some important errors within Your script and this should be like this:

    include("include/data.php");
    $query = "SELECT * FROM myusers WHERE DATE_ADD(FROM_UNIXTIME(lastprelogin), INTERVAL 15 DAY) < CURDATE()";
    $result = mysql_query($query);
    while($user = mysql_fetch_assoc($result)) {
        // assuming that myusers table has these columns: user_id, user_name, user_email, lastprelogin
        //send mail code
        if(mail($user['user_email'],'Please log in','Please login to my site',$headers)) {
            $query1 = "update myusers set lastprelogin='".time()."' where user_id = {$user['usri_id']}";
            $result2 = mysql_query($query1);
        }
    }
    // end.
    

    As a $headers variable You can set a From header, etc. Look for PHP mail function here: http://php.net/mail

    Also the right query for updating should be this one:

    "update myusers set lastprelogin='".time()."' where user_id = {$user['user_id']}"
    

    anyway You will update the lastprelogin of all users everytime…

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

Sidebar

Related Questions

I have this code for sending birthday reminder e-mail. It is executing fine for
I have a reminder notification which passes a parameter to my app like this
I have an asp.net mvc 3 application. In this application I have a reminder
For a wordpress site I have to implement a reminder that will be send
We have a module which will send reminder mail. We are using apache commons
In the past I have tried following this guide for setting up a mail
i have implemented a windows service which is for user's birthday reminder. at midnight
I have reminder with a known ID, but couldn't find a solution to delete
my mail have some tempalte with HTML tags includes and images.. when i am
We have a requirement to add an event reminder when a user enters their

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.