I have a table where I am displaying the latest administrator notes. I am only showing the last 3 notes. I am storing the DATETIME in the database. What I want to do is be able to say, if this datetime is less than 3 days old then display this NEW text.
Now if all 3 notes are in the same day, I want only the latest one to show the NEW text, not all 3.
Here is my PHP:
<?php
if ($stmt = $mysqli->prepare("SELECT note, date_posted, admins.first_name, admins.last_name FROM admin_notes INNER JOIN admins ON admin_notes.admin_id = admins.admin_id ORDER BY date_posted DESC LIMIT 3")) {
$stmt->execute();
$stmt->bind_result($note_text, $note_date, $note_fname, $note_lname);
$stmt->store_result();
while ($stmt->fetch()) {
echo "<tr><td class=\"full\">$note_text<br /><span class=\"from\">".timesince($note_date)." by <strong>$note_fname $note_lname</strong></span></td></tr>";
}
}
?>
Can anyone help me achieve this?
timesince()return New or are you wanting to output this? You're exact question is unclear.