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

  • Home
  • SEARCH
  • 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 7912689
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T13:40:18+00:00 2026-06-03T13:40:18+00:00

I am running a query on my page and it is returning the wrong

  • 0

I am running a query on my page and it is returning the wrong results.
Here is my code:

$timestamp = time();
$query = "SELECT * FROM videos WHERE expire >= $timestamp AND home = 1 AND active = 1 ORDER BY id DESC LIMIT 1";
$result = mysql_query($query) or die(mysql_error());

if(mysql_num_rows($result) > 0) {
    $row = mysql_fetch_array($result);
    foreach ($row as $key => $value) {
        $$key = $value;
    }
}

The problem is, it is returning the SECOND record, and not the most recent ID. But, strange part is, if I run this in the Query window of MySQL, it returns the correct record.

This is the data on the record it should return:
id: 53, videoid: abc123, expire:1335596400, home: 1, active:1

Anyone have any ideas on this?

  • 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-03T13:40:18+00:00Added an answer on June 3, 2026 at 1:40 pm

    1335596400 is 28 april, so cleary is not the result from time();
    It seems that you are runnign the query with another timestamp in MySQL (or without timestamp at all)

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

Sidebar

Related Questions

I'm running this query: SELECT TOP 1 [DVD Copy].[Stock No] FROM [DVD Copy] WHERE
I have the following query running on a classic asp page. sSQL = Select
Evening, I'm currently running this query: SELECT `id`, `type`, `controller` FROM `urls` WHERE `url`
I'm running a query that is timing out for first two times and returning
I am running a query that returns records from the LEFT of the EXCEPT
I am running sparql query PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> SELECT DISTINCT(?film_link) ?film_name
While running FQL query for retrieving page like count, i get 0 count for
I have an ASP page which will query records from a DB Table and
I have a long running SQL query inside a page that I've sped up
Whats this?? my query is: Doctrine_Query::create() ->select('rec.*') ->from('Records rec') ->execute(); Records table contains more

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.