MySQL返回错误的记录

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?

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)

use $query = "SELECT * FROM videos WHERE expire >= $timestamp AND home = 1 AND active = 1 ORDER BY id DESC LIMIT 0,1";

instead

$query = "SELECT * FROM videos WHERE expire >= $timestamp AND home = 1 AND active = 1 ORDER BY id DESC LIMIT 1";