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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T16:11:56+00:00 2026-06-08T16:11:56+00:00

PHP: $current = time(); $time_ago = $current – 45*60; // get the time 45

  • 0

PHP:

$current = time();
$time_ago = $current - 45*60; // get the time 45 mts ago.

MySQL:

I have a table status which has a datetime column ‘modified’;

I am trying to query the table to get the rows that have a modified time lower than that of $time_ago;

My PHP Code:

$this->db->select("(SELECT UNIX_TIMESTAMP(status.modified) FROM status WHERE status_id = 0) AS modified_timestamp" , FALSE);
        $this->db->from('status');
        $this->db->where('status_id', 0);
        $this->db->where('modified_timestamp <', $time_ago);
        $this->db->limit(25);
        $q = $this->db->get();

Getting a db error:

Unknown column ‘modified_timestamp’ in ‘where clause’

SELECT 
    (SELECT UNIX_TIMESTAMP(status.modified) FROM status WHERE status_id = 0) AS modified_timestamp 
    FROM (status) WHERE `status_id` = 0 AND `modified_timestamp` < 1343542758 LIMIT 25
  • 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-08T16:11:57+00:00Added an answer on June 8, 2026 at 4:11 pm

    You realize you can use UNIX_TIMESTAMP() in a where clause, right?

    $this->db->select("UNIX_TIMESTAMP(modified)" , FALSE);
    $this->db->from('status');
    $this->db->where('status_id', 0);
    $this->db->where('UNIX_TIMESTAMP(modified) <', $time_ago);
    $this->db->limit(25);
    $q = $this->db->get();
    

    Note: May not work as-is, I haven’t used this particular DB API, but you get the idea.

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

Sidebar

Related Questions

I have the current PHP: $thisarray[] = #000; SetProfileField('usercss', $USER->id, implode(',',$thisarray)); Which writes #000
I have a PHP script that displays an image(according to the current time) and
In my MySQL table I have a datatime column (the time is saved in
how i am get current time in PST in php and javascript ?
In a PHP site, I have the current time setting: D j M Y,
i am working in php. i have a table EVENT. in which there are
Trying to display current time with PHP (using this ): $date = date('m/d/Y h:i:s
How to create simple PHP COMET server page displaying current time? I need code
How can I display the last time the current document was updated in PHP?
Possible Duplicate: get name of current PHP script in include file Can an included

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.