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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T06:53:13+00:00 2026-06-03T06:53:13+00:00

I have a table backup_history which store sites backup details in my database with

  • 0

I have a table “backup_history” which store sites backup details in my database with the following fields:

id
site_id
backup_file_name
file_size
by (cron/manual)
datetime

For the next backup, I need to find out recent last backup date n time of the site and compare with the settings(daily backup) and run next backup by cron.

But am unable to find out last inserted row with the
site_id = $id AND by = ‘cron’ AND datetime = ‘this will be recent date-time’

$lastbackup = BackupHistory::model()->findByAttributes(array('site_id' => $single_site->id, 'by' => 'cron'));

This code provides a row but not with recent date n time.
May be am going wrong so plz suggest some solution. Thanks !!!

  • 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-03T06:53:14+00:00Added an answer on June 3, 2026 at 6:53 am

    You’ll need to order by your result. So try this:

    $lastbackup = BackupHistory::model()->findByAttributes(array('site_id' => $single_site->id, 'by' => 'cron'),array('order'=>'datetime'));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a large mySQL database that I backup each night via a cron
I have a database backup with 400+ sql files. foreach table there is a
I have a php script that backup my table in .sql format and I
I have a huge table that is mainly used for backup and administrative purposes.
I have a table ProductNumberDuplicates_backups, which has two columns named ProductID and ProductNumber. There
I have table in which I am inserting rows for employee but next time
I have a table which get new data inserted every minute or so. According
I have a table CurrentStatus in my database (subscription database in a merge replication)
I have a MySQL table where there are two fields that make up the
I have a situation in which I have taken a backup(sql scripyts containing the

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.