By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,463 Members | 774 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,463 IT Pros & Developers. It's quick & easy.

Where Do I Place Date Code for Webpage Display

P: n/a
Hi, i have had no problem displaying the current date and time, on a
static webpage. However, when i try to use the various PHP and MySQL
snippets, it does'nt seem to work out.

My success story can be seen on, amongst others,
http:www.manchesterpaul.net/world.war.html
http:www.manchesterpaul.net/world.govroy.html

For this i used the Server Side Includes code of
<!--#echo var="DATE_GMT" -->~~~If this is not today's date, refresh
page for updated version.

I have tried placing the above AND the MySQL, PHP versions detailed
below, on the PHP outputted webpages, above and below the PHP
sections. Also, within the Database Fields, as an entry. In the same
way that one uses HTML code in the displayed results from a PHP query.
Instead of the date and time i get lots of similar output to the bit
below,
#######
Today's Date Is

Today's Date Is Today's Date Is echo("Today Is $today");
echo("The Time Is $now");
#######
Can someone enlighten me as to where the code should be placed. Under
no circumstances do i wish to use Javascript.
The following are my failures;

Today's Date Is <?php echo gmdate("D M d Y"); ?>

Today's Date Is <?php
$today =date("l, d, F, Y");
$now = date("H:i:s");<br>
echo("Today Is $today");<br>
echo("The Time Is $now");
Jul 17 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
In article <30**************************@posting.google.com >,
we*********@manchesterpaul.net (Stupidgirl) wrote:

:Today's Date Is <?php
:$today =date("l, d, F, Y");
:$now = date("H:i:s");<br>
:echo("Today Is $today");<br>
:echo("The Time Is $now");

Today's Date Is <?php echo gmdate("D M d Y H:i:s"). "<br />"; ?>
<?php
$today = date("l, d, F, Y");
$now = date("H:i:s");
echo "Today Is " . $today . "<br />";
echo "The Time Is" . $now;
?>
--
Looks like more of Texas to me.
.... Arizona, where the nights are warm and the roads are straight.
Jul 17 '05 #2

P: n/a
we*********@manchesterpaul.net (Stupidgirl) wrote in message
news:<30**************************@posting.google. com>...

Hi, i have had no problem displaying the current date and time, on a
static webpage. However, when i try to use the various PHP and MySQL
snippets, it does'nt seem to work out.
First of all, are you sure you server even supports PHP and MySQL?
If it does, does your script file have the *.php extension?
The following are my failures;

Today's Date Is <?php echo gmdate("D M d Y"); ?>


This must work if PHP is supported...

Cheers,
NC
Jul 17 '05 #3

P: n/a
nc@iname.com (Nikolai Chuvakhin) wrote in message news:<32**************************@posting.google. com>...
The following are my failures;

Today's Date Is <?php echo gmdate("D M d Y"); ?>


This must work if PHP is supported...

Cheers,
NC


Problem solved, like my 'master', i am new to all this. He pointed out
that i should try separate <?php & ?> brackets for each piece of code
on the page. I had only included the one pair. Presuming that all code
within it would be processed. Thanks anyway. It seems to be doing the
job.
Jul 17 '05 #4

P: n/a
I noticed that Message-ID:
<30**************************@posting.google.com > from Stupidgirl
contained the following:
Problem solved, like my 'master', i am new to all this. He pointed out
that i should try separate <?php & ?> brackets for each piece of code
on the page. I had only included the one pair. Presuming that all code
within it would be processed.


Well it will, as long as the only thing within the tag is code. One of
the really cool things is that you can make non code, conditional.

<?php
if(condition){
?>

Some html that shows if condition is true

<?php }
else{ ?>

Some html that only shows if the condition is false

<?php } ?>
--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Jul 17 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.