I lack experience in the PHP / MySQL environment. I have a MySQL table called MyTable. In it, I have a field called RowTime of type DATETIME NOT NULL. After selecting a string in PHP, I want to check if RowTime is older or younger than 3 days.
Given all types of time types, someone can help execute the following code (I intentionally prevent the processing of various errors):
$dblink = mysqli_connect($dbhost, $dbuser, $dbpass, $dbname);
$dbquery = "SELECT RowTime FROM MyTable WHERE Id='" . $myId . "'";
$result = mysqli_query($dblink, $dbquery);
$numrows = mysqli_num_rows($result);
// ... Verify $numrows == 1 ...
$myRow = mysqli_fetch_assoc($result);
$rowTime = $myRow['RowTime'];
// NEED HELP HERE to check whether $rowTime is older or younger than 3 days
mysqli_free_result($result);
source
share