I run a website where I periodically post articles. I'd like to add a timestamp/datestamp to each article showing the post date (the upload date, I assume, would be the logical choice). I had already asked for advice on this topic; unfortunately, the result is a blank. Literally. Here's an example: http://theapplenewsreel.com/Example.php
After the title and subtitle, there's some small (<h6>) text, which should be followed by the PHP code which displays a timestamp. I'm new to PHP, so I may be doing something wrong. Any advice?
Patiodude
0
Newbie Poster
Recommended Answers
Jump to Postwhat code are you using to display the timestamp?
Jump to PostI just noticed that my browser's "Show Source" doesn't display that particular PHP snippet; just <h6>Posted on </h6>.
No, PHP code will never be displayed in a browser source view, as it is compiled on the server into pure HTML.
<?php date("Y-m-d H:i:s") ?>
This is …
Jump to Postnow is not a keyword, it's a function. You would normally use it when you create a new record.
exampleINSERT INTO dates (date_field) VALUES (NOW())
to execute this in PHP code you call
mysql_query
…mysql_query("INSERT INTO dates (date_field) VALUES (NOW())");
All 9 Replies
|-|x
126
Junior Poster in Training
Patiodude
0
Newbie Poster
|-|x
126
Junior Poster in Training
Patiodude
0
Newbie Poster
|-|x
126
Junior Poster in Training
almostbob
866
Retired: passive income ROCKS
|-|x
commented:
unclear response, inacurate, incorrect and incomplete information
-1
Patiodude
0
Newbie Poster
|-|x
126
Junior Poster in Training
Ty omotayoo
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.