i have a database like picture bellow :
i want to insert date and time based on last modified date from a file on my computer in uploaddate
column automtically using filemtime()
function in php.
i have tried to use this code :
$namefile= $_FILES['filename']['name']; //from file i have uploaded
if (file_exists($namefile))
{
$uploaddate = date ("Y-m-d H:i:s", filemtime($namefile));
}
echo $uploaddate;
and this is my SQL Query :
$import="INSERT into scan (UploadDate, ScanDate, FileName)
values('$uploaddate', '$date', '$namefile')
ON DUPLICATE KEY UPDATE UploadDate='$uploaddate', ScanDate='$date',
FileName='$namefile'";
echo function is running and true but i still can't insert into database.
May you know where is the problem? Thank you so much for your help.