four4swords Posted March 8, 2008 Share Posted March 8, 2008 hi, I got this bit of script here.. which writes down the time you did something... <?php $query_auto = "INSERT INTO timeplayground (dp_name, dp_time) VALUE ('TIME: Auto NOW()', NOW() )"; mysql_query($query_auto) or die(mysql_error()); ?> But.. how would i script it so that php would check to see if 12 hours have gone past? if(time passed >=12 hours){ Done waiting! }else{ wait some more } Anyone get my drift? lol Quote Link to comment Share on other sites More sharing options...
four4swords Posted March 8, 2008 Author Share Posted March 8, 2008 *bump* Quote Link to comment Share on other sites More sharing options...
four4swords Posted March 10, 2008 Author Share Posted March 10, 2008 Please? Quote Link to comment Share on other sites More sharing options...
fenway Posted March 10, 2008 Share Posted March 10, 2008 Where's the DB query for this 12 hour search? Quote Link to comment Share on other sites More sharing options...
four4swords Posted March 11, 2008 Author Share Posted March 11, 2008 here is my bit of code.. $time = $row['TIME']; echo "time=$time&"; $timeneeded = mktime('0', '20', '0', '0', '0', '0'); $now = mktime(); if($now >($timeneeded+$time)){ echo 'yes!! Time is up!'; }else{ echo 'no!! Still gotta wait a bit!'; } I'm trying to make a statement that.. will check to see if the required amount of waiting time has passed or now.. So.. First.. I've written a MySql query that has written the time they first started.. Then.. later when they run this php.. it should tell them if the required amount of waiting time has passed yet or not.. $timeneeded = mktime('0', '20', '0', '0', '0', '0'); This line of code is the time they need to wait.. so.. it's 20minutes here.. if($now >($timeneeded+$time)){ This bit here.. is saying... if the time now.. is greater than the "time you logged in plus the waiting time" then it should echo YES! However! This isn't working! The MySql writes the time in this format.. "2008-03-11 18:21:49" While php writes in this format! .. "1205215154" Which is really confusing! lol Basically.. I just need a bit of code that will check if the waiting time has expired yet or not.. Anyone know how to write it? Quote Link to comment Share on other sites More sharing options...
fenway Posted March 11, 2008 Share Posted March 11, 2008 First, you can issue an SQL query to find out. Second, I find it hard to believe that PHP can't spit out a different date format. But if you really need to, you can always convert the other way. Quote Link to comment Share on other sites More sharing options...
four4swords Posted March 12, 2008 Author Share Posted March 12, 2008 lol there are other formats? I'll try to use other formats to try and solve this problem.. [edit] Yes! I got it working! Thanks! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.