Page 2 of 2

Re: Season Average Temps - worthy of webtags?

Posted: Fri 15 Jun 2012 11:39 am
by RayProudfoot
gemini06720 wrote:Ray (the other Ray), a WIKI is 'stiff', one sided - someone puts information in the WIKI; one searches for information in a WIKI and usually cannot find the appropriate information as the search facilities (engine) are quite limited and the general organization of the WIKI (menus and all) way too restrictive in my views; one then simply gives up looking for information in a WIKI.
My own experiences with Wiki are simply reading a particular article and don't involve searching for something. Your experience suggests it's not ideal for the purposes of interactive teaching.
In the past, I have entered and/or modified articles in the WIKI - updating an article is somewhat of a pain.
I have not yet found a good replacement for the WIKI ... Other than having some areas of a forum which are locked (areas where the tutorials are posted), with additional areas which are hidden and with limited access (areas where knowledgeable people can post suggestions and modifications to the tutorials), and finally, open areas where users can ask for assistance but only if they have taken the time to completely read the tutorial.
I think the W3School site is excellent in teaching HTML etc. I had a play with the SQL element of it yesterday and it's very close to the SQL used in Microsoft Access. If a user has no experience of database then they probably have a steep learning curve but hey, if I can self-teach myself Access via a book 17 years ago I'm sure many will gain useful skills with the W3 site.

If bigmac can come up with a statistic he wants to extract from his dayfile I'd be happy to try and provide the SQL but I wouldn't know how to present the result in a website. It wouldn't be a webtag as such as those can only be processed by Cumulus.

Re: Season Average Temps - worthy of webtags?

Posted: Fri 15 Jun 2012 3:04 pm
by bigmac
Thanks all for input, clearly I have a lot to learn :lol: .
I was using the term "webtags" loosely to define any given statistic that may be required that isn't currently defined by Cumulus. For ease of clarity and to avoid confusing these with the "official" webtags created by Steve, another term may be better, "datatag"?
Didn't want to cause a big debate about the why's and wherefors of WIKI's but interesting that there is clear feelings about them!

If I were to pursue this project, what do others think is a better way to provide easy access to the relevant SQL query and corresponding coding for presentation, for a casual browser of the forums, whilst also allowing it to be updated by others?

What i'd like to try to avoid is having pages of forum messages to trawl through to pick out a particular query and the WIKI seems the only logical solution.

The only reason I'm looking at doing this is clearly Steve gets a lot of requests for this sort of thing, he already spends so much of his valuable time dealing with us all, why not take some of the development pressure of him and do as much of it for him as we can. Obviously Steve, if you feel I am starting to tread on your toes, do tell me so :lol:

Re: Season Average Temps - worthy of webtags?

Posted: Fri 15 Jun 2012 10:14 pm
by beteljuice
... to pick out a particular query ...
Things aren't that simple.

Although you are saying <#webtags> I think it is mostly understood that you mean calculated data, but do you appreciate that this means (most likely) server-side processing using eg. .php to produce the data in the page ?

As I stated earlier, there are various attempts by slightly differing methods to produce customised reports.

If you investigate eg. saratogaWX / carterlake templates (Cumulus version), I believe that there is a user created report that gives what you are asking for (It used to be just for Weather Display versions)

There are report versions on here that could probably modified / ammended, but it is not quite the straightforward "plug-in module" that you envisage. Especially if you want to make it multinational where it is not so much the linguistics but the different units and decimal seperators.

A beteljuice .php prototype Monthly extremes (now effectively superceded by new <#webtags> and a JavaScript version) is only half complete and currently clocks up 2,000 lines of code.
My (old) month summary report prototype, is not much smaller - but does potentially give overkill on data available, and I did sort of envisage hanging seasonal data on the back of it .... but one of those round to it things :lol:

By all means experiment and learn, but don't expect to read an article or pick up a piece of script and run with it. Sometimes it happens - you may be lucky, but be prepared for many hours of head-banging, muttering to youself and slowly losing the ability to communicate with the rest of humanity :D

Re: Season Average Temps - worthy of webtags?

Posted: Sat 30 Jun 2012 4:21 pm
by bigmac
RayProudfoot wrote: Here is the SQL my Access query uses. Apologies if you already know this.

SELECT Avg(DayFile.AverageTemp) AS AvgOfAverageTemp
FROM DayFile
WHERE DayFile.Date Between [Start Date] And Date()-1;
Started trying to have a go at this. I created this in a .php file:

Code: Select all

$SQL = mysql_query("SELECT AVG(AvgTemp) AS 'Average',
		MONTHNAME(LogDate) AS 'Month'
		FROM " . $table_name . "");
$results = mysql_fetch_array($SQL);
	echo "results: ".$results."<br /><br />";

When I try to display the results, I just get:

"results: Array"

I understand that this is becasue I am not outputting the results correctly, but I don't understand how I am meant to display the results (assuming my query is even correct).
Any pointers anyone?

Re: Season Average Temps - worthy of webtags?

Posted: Sat 30 Jun 2012 4:57 pm
by gemini06720
Looking at the PHP documentation for "mysql_fetch_array", the following example is supplied:

Code: Select all

<?php
mysql_connect("localhost", "mysql_user", "mysql_password") or
    die("Could not connect: " . mysql_error());
mysql_select_db("mydb");

$result = mysql_query("SELECT id, name FROM mytable");

while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
    printf("ID: %s  Name: %s", $row[0], $row[1]);  
}

mysql_free_result($result);
?> 
Although I am not that familiar with mySQL, you are, obviously missing the code needed to convert the array you got from the database into a display (with the 'while' and 'print' functions such as demonstrated above) or to convert the array you got from the database into individual variables.

Re: Season Average Temps - worthy of webtags?

Posted: Sat 30 Jun 2012 5:36 pm
by bigmac
Hmmmmm, thanks Ray.
I'm clearly way out of my depth here, I don't think I really understand how to equate that to my SQL query.
I will go away and study some more.........