Jump to content

[SOLVED] Suggestions for mysql/time use?


thewhat

Recommended Posts

Well I know about all that. But I'm not sure how to apply it to get exactly what I need. I'll try to show you an example.

 

info1 - 18 hours

info2 - 12 hours

info3 - 6 hours

 

Each of those countdowns begins whenever the query is set and then is inserted into the other table of info at the end of the specified time. ???

 

Here is a code that DELETEs a data according to a time.

 

$delete = mysql_query("DELETE FROM `table` WHERE `date` < '".(($now = time()) - $period)."'");

 

 

$period would be the time in seconds, just divide 18 hours into seconds.

 

i am not sure if you want an INSERT STATEMENT, because then you would use if/else

You pm'ed me on a question and here is your answer/

 

<?php

   // Alright, lets say you want to insert data if it is certain date // 
   // First you need the dates for this
   
   $period = array();
   $period[then] = mktime(0, 0, 0, 12, 32, 2007); // This is only a certain date in 2007 
   $period[now]  = time(); // The current Timestamp for now

   if($period[then]==$period[now]){ // If it is the date where you want things to change
    
   // Then you can insert a data  
   mysql_query("INSERT INTO `table` ('field','field','field') VALUES ('$value','$value','$value')")or die(mysql_error());

}   
  




?>

 

Thats what i ment.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.