Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 01-08-2008, 07:47 PM PHP countdown
MoForce's Avatar
Super Talker

Posts: 145
Name: Jack Shalt
Trades: 0
I've got the countdown done but theres one problem...

Quote:
Cannot redeclare countdown()(previously declared in...
So I know what it means and all that I can't run more than one of these countdowns on the same script

this is my countdown script btw
PHP Code:
function countdown($year$month$day$hour$minute$second)
{
 
  
$the_countdown_date gmmktime($hour$minute$second$month$day$year);

  
$today time();

  
$difference $the_countdown_date $today;
  if (
$difference 0$difference 0;

  
$days_left floor($difference/60/60/24);
  
$hours_left floor(($difference $days_left*60*60*24)/60/60);
  
$minutes_left floor(($difference $days_left*60*60*24 $hours_left*60*60)/60);
  
$seconds_left floor($difference $days_left*60*60*24 $hours_left*60*60 $minutes_left*60);
    
  echo 
"".$hours_left.":".$minutes_left.":".$seconds_left."";

and so I was wondering if there was a way for me to run as many on these countdowns as I want... the actual countdown amounts are called by this

PHP Code:
countdown($x['hour'], $x['minute'], $x['second'], $x['month'], $x['day'], $x['year']); 
the data is grabbed from a MySQL database and all that part is fine

Thanks!

Last edited by MoForce; 01-08-2008 at 07:51 PM..
MoForce is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 01-08-2008, 07:50 PM Re: PHP countdown
tripy's Avatar
Do not try this at home!

Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
Trades: 0
Of course you can.

Your error is not because you tried to use 2, but because you tried to declare 2 different functions with the same name, which PHP refuse.

Declare the function once, and call it as many times you want with countdown(x,y,z...);
__________________
Only a biker knows why a dog sticks his head out the window.
tripy is offline
Reply With Quote
View Public Profile Visit tripy's homepage!
 
Old 01-08-2008, 08:02 PM Re: PHP countdown
MoForce's Avatar
Super Talker

Posts: 145
Name: Jack Shalt
Trades: 0
Quote:
Originally Posted by tripy View Post
Of course you can.

Your error is not because you tried to use 2, but because you tried to declare 2 different functions with the same name, which PHP refuse.

Declare the function once, and call it as many times you want with countdown(x,y,z...);
aaaaahhhhhhaaaaa!

It worked! Thanks!
MoForce is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to PHP countdown
 

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 On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.61447 seconds with 12 queries