[Phphtmllib-devel] SF.net SVN: phphtmllib:[3378] trunk/open2300/lib/modules/home/widgets/ TickerCon
Status: Beta
Brought to you by:
hemna
From: <he...@us...> - 2010-02-26 16:25:33
|
Revision: 3378 http://phphtmllib.svn.sourceforge.net/phphtmllib/?rev=3378&view=rev Author: hemna Date: 2010-02-26 16:25:22 +0000 (Fri, 26 Feb 2010) Log Message: ----------- fixed queries Modified Paths: -------------- trunk/open2300/lib/modules/home/widgets/TickerConditions.inc Modified: trunk/open2300/lib/modules/home/widgets/TickerConditions.inc =================================================================== --- trunk/open2300/lib/modules/home/widgets/TickerConditions.inc 2010-02-26 07:24:25 UTC (rev 3377) +++ trunk/open2300/lib/modules/home/widgets/TickerConditions.inc 2010-02-26 16:25:22 UTC (rev 3378) @@ -49,26 +49,40 @@ $today = date("Y-m-d"); //TEMPERATURE - $stmt = $db->queryBindOneRowCache("Select min(temp_out) as low, datetime from weather where datetime like :date", - array(":date" => $today.'%'), 60*5); + $sql = "select min(temp_out) as low, ". + "(select max(datetime) from weather where temp_out=". + "(select max(temp_out) from weather where datetime like :date) and datetime like :date)". + " as datetime from weather where datetime like :date"; + $stmt = $db->queryBindOneRowCache($sql, array(":date" => $today.'%'), 60); $this->temp_low_high["low"] = $stmt->low; $this->temp_low_high["low_str"] = $colds.$stmt->low. "°F".$colde." at " . substr($stmt->datetime,10); - $stmt = $db->queryBindOneRowCache("Select max(temp_out) as high, datetime from weather where datetime like :date", - array(":date" => $today.'%'), 60*5); + + $sql = "select max(temp_out) as high, ". + "(select max(datetime) from weather where temp_out=". + "(select max(temp_out) from weather where datetime like :date) and datetime like :date)". + " as datetime from weather where datetime like :date"; + $stmt = $db->queryBindOneRowCache($sql, array(":date" => $today.'%'), 60); $this->temp_low_high["high"] = $stmt->high; $this->temp_low_high["high_str"] = $hots.$stmt->high . "°F".$hote." at " . substr($stmt->datetime,10); //HUMIDITY - $stmt = $db->queryBindOneRowCache("Select max(rel_hum_out) as high, datetime from weather where datetime like :date", - array(":date" => $today.'%'), 60*5); + $sql = "select max(rel_hum_out) as high, ". + "(select max(datetime) from weather where rel_hum_out=". + "(select max(rel_hum_out) from weather where datetime like :date) and datetime like :date)". + " as datetime from weather where datetime like :date"; + $stmt = $db->queryBindOneRowCache($sql, + array(":date" => $today.'%'), 60); $this->temp_low_high["high_hum"] = $stmt->high; $this->temp_low_high["high_hum_str"] = $hots.$stmt->high . "%".$hote." at " . substr($stmt->datetime,10); - $stmt = $db->queryBindOneRowCache("Select min(rel_hum_out) as low, datetime from weather where datetime like :date", - array(":date" => $today.'%'), 60*5); + $sql = "select min(rel_hum_out) as low, ". + "(select max(datetime) from weather where rel_hum_out=". + "(select max(rel_hum_out) from weather where datetime like :date) and datetime like :date)". + " as datetime from weather where datetime like :date"; + $stmt = $db->queryBindOneRowCache($sql, array(":date" => $today.'%'), 60); $this->temp_low_high["low_hum"] = $stmt->low; $this->temp_low_high["low_hum_str"] = $colds.$stmt->low . "%".$colde." at " . substr($stmt->datetime,10); @@ -85,7 +99,7 @@ //WIND $stmt = $db->queryBindOneRowCache("Select avg(wind_speed) as average from weather where datetime like :date", - array(":date" => $today.'%'), 60*5); + array(":date" => $today.'%'), 60); $this->wind['average'] = sprintf("%0.2f",$stmt->average); //get the peak winds @@ -93,7 +107,7 @@ $sql = "select datetime,wind_speed, wind_angle, wind_direction from weather where ". "wind_speed = (select max(wind_speed) from weather where datetime like :date) ". "and datetime like :date2"; - $stmt = $db->queryBindOneRowCache($sql, array(":date" => $today.'%',":date2" => $today.'%'), 60*5); + $stmt = $db->queryBindOneRowCache($sql, array(":date" => $today.'%',":date2" => $today.'%'), 60); $log->debug(var_export($stmt,true)); $this->peak_wind['speed'] = $stmt->wind_speed; $this->peak_wind['angle'] = $stmt->wind_angle; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |