NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page PHP/MySQL Help

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search
5 members in live chat ~  


Reply
 
LinkBack Thread Tools
Old 07-23-2010, 06:34 PM THREAD STARTER               #1 (permalink)
NamePros Regular
 
freeflow's Avatar
Join Date: Dec 2006
Posts: 236
freeflow is on a distinguished road
 



Help! PHP/MySQL Help


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”
????: NamePros.com http://www.namepros.com/programming/668411-php-mysql-help.html
-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 by freeflow; 07-23-2010 at 07:33 PM.
freeflow is offline   Reply With Quote
Old 07-24-2010, 08:10 AM   #2 (permalink)
NamePros Member
Join Date: Nov 2009
Posts: 142
smghost001 will become famous soon enoughsmghost001 will become famous soon enough
 



$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
__________________
Scientific Calculator - SciCalculator.com

Dns For Sale: Fuelcooler/s(.dot)com - RuralRiding(.dot)com - AttackTank(.dot)com - Foredoomed(.dot)com - SavingCalories(.dot)com - FairDealFinder(.dot)com
smghost001 is offline   Reply With Quote
Old 07-24-2010, 10:16 AM   #3 (permalink)
Domains my Dominion
 
sdsinc's Avatar
Join Date: Aug 2005
Location: Web 1.0
Posts: 9,963
sdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatness
 


Third World Education Find Marrow Donors! Find Marrow Donors! Find Marrow Donors! Find Marrow Donors! Animal Rescue Animal Cruelty AIDS/HIV Animal Rescue Wildlife Breast Cancer Animal Rescue Wildlife
Something like this:
Code:
UPDATE [table]
SET status=3
WHERE DATE_ADD([Timestamp column],INTERVAL [number of days] DAY) >= CURDATE()
AND status=0
__________________
NameNewsletter.com - free lists of available domain names
ZoneFiles.net (beta) - ccTLD and gTLD droplists
sdsinc is offline   Reply With Quote
Old 07-25-2010, 04:56 PM THREAD STARTER               #4 (permalink)
NamePros Regular
 
freeflow's Avatar
Join Date: Dec 2006
Posts: 236
freeflow is on a distinguished road
 



Thanks for your replies. They helped me find the right code.


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'"); 

}
freeflow is offline   Reply With Quote
Old 07-26-2010, 07:37 AM   #5 (permalink)
NamePros Member
Join Date: Nov 2009
Posts: 142
smghost001 will become famous soon enoughsmghost001 will become famous soon enough
 



no probs knew it was something along those lines you needed cheers
__________________
Scientific Calculator - SciCalculator.com

Dns For Sale: Fuelcooler/s(.dot)com - RuralRiding(.dot)com - AttackTank(.dot)com - Foredoomed(.dot)com - SavingCalories(.dot)com - FairDealFinder(.dot)com
smghost001 is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


 
All times are GMT -7. The time now is 02:36 PM.

Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger