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. ???

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.