We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,194 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Is there any to timestamp articles with PHP without using a database?

I know little PHP, but even less MySQL, and my host doesn't allow remote database connections (for example, from Dreamweaver), so in addition to being confusing to me, database management is impractical. Is there any way to put a timestamp on an article automatically, without resorting to MySQL tables?

3
Contributors
2
Replies
7 Hours
Discussion Span
10 Months Ago
Last Updated
4
Views
Patiodude
Junior Poster in Training
54 posts since Dec 2011
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

If you're using flat files to store information, linux stores the creation date of the file and you can use that, but I assume that if you don't have access to a database you're not going to have access to the shell either.

Best suggestion would be for the first line of the article to be its date ;) Even better suggestion would be to find a new host.

Dani
The Queen of DaniWeb
Administrator
21,344 posts since Feb 2002
Reputation Points: 1,555
Solved Threads: 367
Skill Endorsements: 122

There is a PHP class that gives you a virtual SQL database using flat files. see-> http://www.fsql.org/

Alternatively you could code something up yourself using fileatime & filetime.
<?php
// get file access/modification times
echo "Last accessed on: " . date("d-m-y", fileatime('myfile.html'));

echo "Last modified on: " . date("d-m-y", filemtime('myfile.html'));
?>

Sogo7
Light Poster
41 posts since May 2011
Reputation Points: 10
Solved Threads: 13
Skill Endorsements: 1

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.0620 seconds using 2.67MB