24小时后价值不会改变

I find code on this forum and I go use it.

$sql2 = "SELECT TIME_TO_SEC(TIMEDIFF(NOW(), time)) FROM database WHERE id = 1";
$result = $conn->query($sql2);

if ($result >= 86400) { 
    $sql5 = "UPDATE points SET value = 1 WHERE id = 1"; 
    $result = $conn->query($sql5);
    $sql6 = "UPDATE points SET time = NOW() WHERE id = 1";
    $result = $conn->query($sql6);
}

Here is my code.

It doesn´t change after 24 hours.

SQL - time:

2017-07-16 11:10:06

It saves time.

And it doesn´t work.

So thank you guys for help.

I have this now:

    $sql2 = "SELECT TIME_TO_SEC(TIMEDIFF(NOW(), `dailytime`)) FROM `points` WHERE steamid = '".$steamprofile['steamid']."'";
    $result = $conn->query($sql2);

    if ($result >= 86400) { 
        $sql5 = "UPDATE points SET daily = 1 WHERE steamid = '".$steamprofile['steamid']."'"; 
        $result = $conn->query($sql5);

        $sql6 = "UPDATE points SET `dailytime` = NOW() WHERE steamid = '".$steamprofile['steamid']."'";
        $result = $conn->query($sql6);
    }

Oh silly us, we missed the obvious mistake.

The result of a ->query() is a handle/object that allows you to process the results set generated by the query. It does not return the result set itself.

Also with these queries, adding an alias name to the calculation makes getting at the column in the resultset easier.

Assuming you are using mysqli_ you need to add some code to get your result set

$sql2 = "SELECT TIME_TO_SEC(TIMEDIFF(NOW(), `dailytime`)) as the_diff 
        FROM `points` 
        WHERE steamid = '".$steamprofile['steamid']."'";

$result = $conn->query($sql2);

$row = $result->fetch_assoc();

if ($row['the_diff'] >= 86400) { 

    // You can change more than one column in a single query
    // so you only need one UPDATE here
    $sql5 = "UPDATE points SET daily = 1, `dailytime` = NOW()
             WHERE steamid = '{$steamprofile['steamid']}'"; 
    $result = $conn->query($sql5);

}