COUNTDOWN

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Parody
Forum Contributor
Posts: 252
Joined: Fri May 06, 2005 7:06 pm
Location: Great Britain

Post by Parody »

$time = date("d:H:i:s") + 200;
print "$time";

If I do that, at this current time I get 219
Parody
Forum Contributor
Posts: 252
Joined: Fri May 06, 2005 7:06 pm
Location: Great Britain

Post by Parody »

Warning: mktime() [function.mktime]: Windows does not support negative values for this function in c:\program files\apache group\Apache\htdocs\timecheck.php on line 2
-1

Hmm...

This is the code:


Code: Select all

$time  = mktime(0, 0, 0, date(&quote;d&quote;),  date(&quote;H&quote;), date(&quote;i&quote;)+2,  date(&quote;s&quote;));
print &quote;$time&quote;;
I honestly have no idea :(
Parody
Forum Contributor
Posts: 252
Joined: Fri May 06, 2005 7:06 pm
Location: Great Britain

Post by Parody »

$time = mktime(0, 0, 0, 0, date("d"), date("H"), date("i")+2, date("s"));
print "$time";

I didn't have enough of: 0,

But I still get this error:

Warning: Wrong parameter count for mktime() in c:\program files\apache group\Apache\htdocs\timecheck.php on line 2
Parody
Forum Contributor
Posts: 252
Joined: Fri May 06, 2005 7:06 pm
Location: Great Britain

Post by Parody »

Oh, sorry, line 2 is this one:

$time = mktime(0, 0, 0, date("d"), date("H"), date("i")+2, date("s"));
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Post by Burrito »

are you still trying to figure out how to insert the time to the db? I got lost when you started working with mktime...

I thought your goal was to insert the time to the db with some seconds added to it?

if that's still your plan here's a hint :wink: :

Code: Select all

mysql_query("insert into... '".date("h:i:s",strtotime(...
I know it's a bone, but that's the best way to learn, do it yourself...
Parody
Forum Contributor
Posts: 252
Joined: Fri May 06, 2005 7:06 pm
Location: Great Britain

Post by Parody »

I finished it, at last.

Thanks for all your help.

I eventually just added the 'current time' to the database, and upon loading the page the next time it would check if that time was 120 seconds ago, if not then die and display a message.
Post Reply