Dynadot — .com Registration $8.99

PHP/MySQL Help

Spacemail by SpaceshipSpacemail by Spaceship
Watch

freeflow

Established Member
Impact
13
Hi everyone

I need some help with a PHP/MySQL script.

What I’d like to do:

-Change the status of all MySQL entries that exceed a different number of days and fulfill certain conditions.
-Timestamp (MySQL) plus number of days (PHP variable read from each MySQL entry) >= than todays date.
-Change only entries that have the status = “0”
-Change their status to “3”

I hope this makes some kind of sense and you can use this description to help me?


Examples:

Timestamp 2010-07-23 20:18:18 + Number of days in MySQL = 30 to be used in PHP script & change status if <= Today
Timestamp 2010-06-23 17:15:01 + Number of days in MySQL = 90 to be used in PHP script & change status if <= Today
etc.
 
Last edited:
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
AfternicAfternic
$temp = strtotime($timestamp)/86400;
$numMYSQL = Number of Days in MySQL;

if ($temp - $numMYSQL < 1) {
//today
}
else {
// not today
}

something along those lines anyway coz i didnt rly understand what you need
 
1
•••
Something like this:
Code:
UPDATE [[I]table[/I]]
SET status=3
WHERE DATE_ADD([[I]Timestamp column[/I]],INTERVAL [[I]number of days[/I]] DAY) >= CURDATE()
AND status=0
 
0
•••
Thanks for your replies. They helped me find the right code. :laugh:


Code:
$temp = strtotime($timestamp. "+$days days")/86400;

$temp2 = time();

$temp2 = ($temp2)/86400;


if ($temp - $temp2 < 1) {

mysql_query("UPDATE Ads1 SET Status ='3'  WHERE ID = '$id' AND Status = '0'"); 

}
 
0
•••
no probs :) knew it was something along those lines you needed :P cheers
 
0
•••
Dynadot — .com Registration $8.99Dynadot — .com Registration $8.99

We're social

Unstoppable Domains
Domain Recover
DomainEasy — Zero Commission
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back