I have a database that stores the time when a form is submitted. There are two forms thus 2 different timings are stored. How do I automatically get the bigger time to minus the smaller time and display the results.
Things I've tried: (a part of index.php)
$timeR = 'timeR';
$timeB = 'timeB';
if ($timeR > $timeB) {
echo ( strtotime($timeR) - strtotime($timeB) );
}
else{
echo ( strtotime($timeB) - strtotime($timeR) );
}
timeR
and timeB
is the row name that is used to store the time.
The code above doesn't work, no errors but nothing is printing.
$row1 = mysqli_fetch_array($result1)
$row = mysqli_fetch_array($result);
echo ( strtotime($row1['timeB']) - strtotime($row['timeR']) );
This code above works and prints something but the numbers printed are wrong??
Time is stored using another page that inserts data into the database which then redirects you to index.php
Time is stored like this on insertblue.php:
$currenttimeB = date('Y-m-d - H:i:s');
echo $sql="UPDATE indextableblueupdated SET FTPBreach = '$_POST[FTPBreach]',
VictimIP = '$_POST[VictimIP]',
VictimPass = '$_POST[VictimPass]',
SQLUser = '$_POST[SQLUser]',
SQLPass = '$_POST[SQLPass]',
message = '$_POST[message]',
timeB = '$currenttimeB' WHERE user = '2'" ;
Similarly I have another page called insertred.php
which does the exact same thing as insertblue.php