[PHP] Redeclare formatdate

2003-02-01 Thread Miguel Brás
  Hi,

  I have this message coming when calling the page main.php

  Fatal error: Cannot redeclare formatdate() in
/home/virtual/site239/fst/var/www/html/home/not_main.php on line 3

  the code related to this message is:

  ?
  // format MySQL DATETIME value into a more readable string
  function formatDate($val)
  {
   $arr = explode(/, $val);
   return date(d/m/y, mktime(0,0,0, $arr[1], $arr[2], $arr[0]));
  }
  ?

  I use this code is some other pages and it works well, but here the code
is used in page not_main.php whose I included it on main.php using require()
function

  Anyone have a tip for it?


  Thx
  Miguel





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] Redeclare formatdate

2003-02-01 Thread John W. Holmes
   I have this message coming when calling the page main.php
 
   Fatal error: Cannot redeclare formatdate() in
 /home/virtual/site239/fst/var/www/html/home/not_main.php on line 3
 
   the code related to this message is:
 
   ?
   // format MySQL DATETIME value into a more readable string
   function formatDate($val)
   {
$arr = explode(/, $val);
return date(d/m/y, mktime(0,0,0, $arr[1], $arr[2], $arr[0]));
   }
   ?
 
   I use this code is some other pages and it works well, but here the
code
 is used in page not_main.php whose I included it on main.php using
 require()
 function

Your function is being declared twice, which means that this file is
probably being included or required twice. Look through your code...

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] Redeclare formatdate

2003-02-01 Thread Jason Sheets
This is a good reason to use include_once and require_once.

Jason

On Sat, 2003-02-01 at 15:59, John W. Holmes wrote:
I have this message coming when calling the page main.php
  
Fatal error: Cannot redeclare formatdate() in
  /home/virtual/site239/fst/var/www/html/home/not_main.php on line 3
  
the code related to this message is:
  
?
// format MySQL DATETIME value into a more readable string
function formatDate($val)
{
 $arr = explode(/, $val);
 return date(d/m/y, mktime(0,0,0, $arr[1], $arr[2], $arr[0]));
}
?
  
I use this code is some other pages and it works well, but here the
 code
  is used in page not_main.php whose I included it on main.php using
  require()
  function
 
 Your function is being declared twice, which means that this file is
 probably being included or required twice. Look through your code...
 
 ---John W. Holmes...
 
 PHP Architect - A monthly magazine for PHP Professionals. Get your copy
 today. http://www.phparch.com/
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Redeclare formatdate

2003-02-01 Thread Miguel Brás
Thx for the help...

Miguel
Jason Sheets [EMAIL PROTECTED] escreveu na mensagem
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 This is a good reason to use include_once and require_once.

 Jason

 On Sat, 2003-02-01 at 15:59, John W. Holmes wrote:
 I have this message coming when calling the page main.php
  
 Fatal error: Cannot redeclare formatdate() in
   /home/virtual/site239/fst/var/www/html/home/not_main.php on line 3
  
 the code related to this message is:
  
 ?
 // format MySQL DATETIME value into a more readable string
 function formatDate($val)
 {
  $arr = explode(/, $val);
  return date(d/m/y, mktime(0,0,0, $arr[1], $arr[2], $arr[0]));
 }
 ?
  
 I use this code is some other pages and it works well, but here the
  code
   is used in page not_main.php whose I included it on main.php using
   require()
   function
 
  Your function is being declared twice, which means that this file is
  probably being included or required twice. Look through your code...
 
  ---John W. Holmes...
 
  PHP Architect - A monthly magazine for PHP Professionals. Get your copy
  today. http://www.phparch.com/
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php