5,838
edits
m (→Schema) |
|||
*[http://sandaysoft.com/forum/viewtopic.php?f=14&t=16880#p129719 MySQL code help] - This shows a snippet of a PHP script by SFWS for creating a table that for a particular criterion shows the value with all the years as column headers and all the days of a year (1 Jan to 31 Dec) as rows. The provided script uses standard HTML to show/hide each month.
*[http://sandaysoft.com/forum/viewtopic.php?f=14&t=10755#p87081 Top 10 Records Page]- This script by Mark Crossley runs several queries against the daily summary table of a database and picks various extremes displaying the top ten extremes (e.g. ). The latest source php can be seen using a [http://weather.wilmslowastro.com/top10s.php?view=sce query-string on Mark Crossley's web site] and there have been several updates since the forum thread was created.
*[http://sandaysoft.com/forum/viewtopic.php?f=14&t=16534#p126964 What to do with data from MySQL] - This posting lists a number of web pages on PaulMy's web site where he presents
*[http://sandaysoft.com/forum/viewtopic.php?f=14&t=7834#p66013 This day last year page] - This post has a query in a php file (as you save the download change '.txt' to '.php') that will extract from the daily summary table in a database, values for one year ago, two years ago to feed a web page that displays all the summary statistics for today and the corrsponding ones for earlier years.
There are various scripts out there that output graphs from the values read, I have not identifed a particular one to reference here yet. If you find a site dislaying a graph you would like to copy on your own site, you might be able to see the PHP source that is responsible, but as I have commented [http://sandaysoft.com/forum/viewtopic.php?f=14&t=16425&p=126065#p126065 elsewhere] most authors do not make it easy to see their code. Of course one of the reasons for using PHP script is that processing is done quickly on the web server and only the resulting HTML is passed onto the client browser and this does protect interlectual property and adds security by not showing the database access code.
=== Other jQuery approaches ===
If you extract all the values off the daily summary table with a simple "SELECT * FROM name_of_your_table" query and store those values in XML format using a PHP script called 'read_dayfile_historic.php', then you can use a jQuery library routine to produce a table of values using JavaScript:
<pre>
<script src="jquery.jqGrid.min.js" type="text/javascript"></script>
<script type="text/javascript">
jQuery(document).ready(function(){
jQuery("#list").jqGrid({
url:'read_dayfile_historic.php',
datatype: 'xml',
height: 460,
width: 970,
mtype: 'GET',
colNames:['Date','Highest<br/>Gust<br/>(mph)','Wind<br/>Bearing','Time of<br/>Gust','Min. Temp<br/>(°C)','Time of<br/>Min.','Max. Temp<br/>(°C)','Time of<br/>Max.','Avg. Temp<br/>(°C)','Lowest<br/>pressure<br/>(mb)','Time of<br/>low','Highest<br/>pressure<br/>(mb)','Time of<br/>high','Highest<br/>Rain rate<br/>(mm/hr)','Time of<br/>High Rate','Total Rain<br/>fall (mm)','Tot.Wind<br/>run'],
colModel :[
{name:'UKLogDate', index:'LogDate', width:65, label: 'Date', sortable: true},
{name:'HighestWindGust', index:'HighWindGust', width:50, align:'right'},
{name:'HWindGBear', index:'HWindGBear', width:50, align:'right'},
{name:'THWindG', index:'THWindG', width:55, align:'right', sortable: false},
{name:'MinTemp', index:'MinTemp', width:55, align:'right'},
{name:'TMinTemp', index:'TMinTemp', width:55, align:'right', sortable: false},
{name:'MaxTemp', index:'MaxTemp', width:60, align:'right'},
{name:'TMaxTemp', index:'TMaxTemp', width:55, align:'right', sortable: false},
{name:'AvgTemp', index:'AvgTemp', width:57, align:'right'},
{name:'MinPress', index:'MinPress', width:60, align:'right'},
{name:'TMinPress', index:'TMinPress', width:50, align:'right', sortable: false},
{name:'MaxPress', index:'MaxPress', width:60, align:'right'},
{name:'TMaxPress', index:'TMaxPress', width:50, align:'right', sortable: false},
{name:'MaxRainRate', index:'MaxRainRate', width:55, align:'right'},
{name:'TMaxRR', index:'TMaxRR', width:60, align:'right', sortable: false},
{name:'TotRainFall', index:'TotRainFall', width:55, align:'right'},
{name:'TotWindRun', index:'TotWindRun', width:55, align:'right'}],
pager:'#pager',
rowNum:19,
rowList:[10,20,30],
viewrecords: true,
sortname: "LogDate",
sortorder: "desc",
caption: 'Daily Statistics'
});
});
</script>
</pre>
The above code uses jQuery to output a table showing all the statistics from the database, note that any column containing values can be clicked upon and the table will be resorted by those values, but any column containing time-stamps has the sorting set to false, so you cannot pick them.
|
edits