I am not very good in php and javacript, need help on how to fix the next info,
Need to show total days in html table.
I have the first date in mysql 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
How do I get it to work
Edit: Further information that OP posted in a solution. Putting it here before it is deleted
it is giving error in
echo ("%d days\n", $days);
.
So when I take out that line then it the give me this error.
Warning: Use of undefined constant today - assumed 'today' (this will throw an Error in a future version of PHP) in C:\Mylinks\Kripto\Crypto\index.php on line 694
I do not have "today;" in my database. I just want it to get date from system date for it.
What I have tried:
<pre lang="PHP"><pre><?php $date = $checkSqlRow["DAYS_OLD"]; ?></td>
<script type="text/javascript">
$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));
echo ("%d days\n", $days);
</script>