Connecting Tech Pros Worldwide Help | Site Map

Where Do I Place Date Code for Webpage Display

 
LinkBack Thread Tools Search this Thread
  #1  
Old July 17th, 2005, 01:09 AM
Stupidgirl
Guest
 
Posts: n/a
Default Where Do I Place Date Code for Webpage Display

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");

  #2  
Old July 17th, 2005, 01:09 AM
Warren Oates
Guest
 
Posts: n/a
Default Re: Where Do I Place Date Code for Webpage Display

In article <30d56be7.0311151122.1130495c@posting.google.com >,
webmistress@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.
  #3  
Old July 17th, 2005, 01:09 AM
Nikolai Chuvakhin
Guest
 
Posts: n/a
Default Re: Where Do I Place Date Code for Webpage Display

webmistress@manchesterpaul.net (Stupidgirl) wrote in message
news:<30d56be7.0311151122.1130495c@posting.google. com>...[color=blue]
>
> 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.[/color]

First of all, are you sure you server even supports PHP and MySQL?
If it does, does your script file have the *.php extension?
[color=blue]
> The following are my failures;
>
> Today's Date Is <?php echo gmdate("D M d Y"); ?>[/color]

This must work if PHP is supported...

Cheers,
NC
  #4  
Old July 17th, 2005, 01:12 AM
Stupidgirl
Guest
 
Posts: n/a
Default Re: Where Do I Place Date Code for Webpage Display

nc@iname.com (Nikolai Chuvakhin) wrote in message news:<32d7a63c.0311151808.5140f68b@posting.google. com>...[color=blue][color=green]
> > The following are my failures;
> >
> > Today's Date Is <?php echo gmdate("D M d Y"); ?>[/color]
>
> This must work if PHP is supported...
>
> Cheers,
> NC[/color]

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.
  #5  
Old July 17th, 2005, 01:12 AM
Geoff Berrow
Guest
 
Posts: n/a
Default Re: Where Do I Place Date Code for Webpage Display

I noticed that Message-ID:
<30d56be7.0311180959.2c9b2605@posting.google.com > from Stupidgirl
contained the following:
[color=blue]
>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.[/color]

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/
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.