how to use filemtime function in PHP?
<p>i have a database like picture bellow :</p>

<p><a href="http://i.stack.imgur.com/0XRg6.png" rel="nofollow">database</a></p>

<p>i want to insert date and time based on last modified date from a file on my computer in <code>uploaddate</code> column automtically using <code>filemtime()</code> function in php.</p>

<p>i have tried to use this code :</p>

<pre><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;
</code></pre>

<p>and this is my SQL Query :</p>

<pre><code>$import="INSERT into scan (UploadDate, ScanDate, FileName) 
         values('$uploaddate', '$date', '$namefile')
         ON DUPLICATE KEY UPDATE UploadDate='$uploaddate', ScanDate='$date',  
         FileName='$namefile'";
</code></pre>

<p>echo function is running and true but i still can't insert into database.</p>

<p>May you know where is the problem? Thank you so much for your help.</p>