NameSilo

PHP help !

SpaceshipSpaceship
Watch
Impact
9
This is for a widget that displays returns results for the last 30 days ..I cant figure out how to change for last 48 hours... the database uses timestamp for dates also..

//Min & Max
$Price = "SELECT AVG(`price_snow`),AVG(`price_rain`),AVG(`price_spread`) FROM
`prices` WHERE `approved`='1' AND `archive`!='1'";
$Min = $Db->FetchArray($Price);

// Set price variables
$avg_snow_price = round($Min['AVG(`price_snow`)'], 2);
$avg_rain_price = round($Min['AVG(`price_rain`)'], 2);
$price_spread = round($Min['AVG(`price_spread`)'],2);


My usual database.php script person has apparently taken a leave of absense.. in College
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
There's nothing in that code that tells it 30 days. My guess is what ever sets it as archive does so after 30 days. That's what will need to be changed. PM me if you would like help.
 
0
•••
Code:
//Min & Max 
$Price = "SELECT AVG(`price_snow`),AVG(`price_rain`),AVG(`price_spread`) FROM 
`prices` WHERE `approved`='1' AND `archive`!='1'
AND date >= DATE_SUB(NOW(), INTERVAL 2 DAY)"; 

$Min = $Db->FetchArray($Price);

Replace: date with your own date column.
That should do it.

-Peter
 
0
•••
psalzmann said:
Code:
//Min & Max 
$Price = "SELECT AVG(`price_snow`),AVG(`price_rain`),AVG(`price_spread`) FROM 
`prices` WHERE `approved`='1' AND `archive`!='1'
AND date >= DATE_SUB(NOW(), INTERVAL 2 DAY)"; 

$Min = $Db->FetchArray($Price);

Replace: date with your own date column.
That should do it.

-Peter

Peter the database person switched from DATE to TIMESTAMP last year...dont recall off hand the reasoning...something about UNIx ..I dont recall

But should still be be able to do something with Timestamp as I see it used in other areas of code for the site (instead of DATE)

chadsmith.. that's what I also couldn't sort out and also reasoned the 30 days has to somehow be tied into the the Monthly Archive .. the end of the Month all the Prices are "Archived" and we start a new Month ..I will look in more files and the database for clues as to where that part of the code/script is at
 
0
•••
Appraise.net

We're social

Escrow.com
Spaceship
Rexus Domain
CryptoExchange.com
Domain Recover
CatchDoms
DomDB
NameFit
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back