Need to show total days in html table.
I have the first date in myhpadmin table [CREATED_AT] and then todays date (not in database). Only what to show the total days in my html table, when I open the webpage.
Did get the script code from searching , but it does not show the info at all.
Not sure how to use print in the script
<td>
<?php $date = $checkSqlRow["DAYS_OLD"]; ?></td>
<script>
$date1 = $date = $checkSqlRow["CREATED_AT"];
$date2 = today;
$diff = abs(strtotime($date2) - strtotime($date1));
$years = floor($diff / (365*60*60*24));
$months = floor(($diff - $years * 365*60*60*24) / (30*60*60*24));
$days = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24));
printf("%d days\n", $days);
With help from someone, it is working! within the td