Welcome to the Cumulus Support forum.

Latest Cumulus MX V3 release 3.28.5 (build 3282) - 23 February 2024

Cumulus MX V4 beta test release 4.0.0 (build 4017) - 17 March 2024

Legacy Cumulus 1 release v1.9.4 (build 1099) - 28 November 2014 (a patch is available for 1.9.4 build 1099 that extends the date range of drop-down menus to 2030)

Download the Software (Cumulus MX / Cumulus 1 and other related items) from the Wiki

Rolling Weekly Data - Displaying data on website

Other discussion about creating web sites for Cumulus that doesn't have a specific subforum

Moderator: daj

sfws
Posts: 1183
Joined: Fri 27 Jul 2012 11:29 am
Weather Station: Chas O, Maplin N96FY, N25FR
Operating System: rPi 3B+ with Buster (full)

Re: Rolling Weekly Data - Displaying data on website

Post by sfws »

griffo42 wrote: Mon 25 Apr 2022 3:32 am I think that I have implemented the changes to my script that you suggested. A new Zipped copy is attached.
Actually, you did not add the error reporting I suggested. That would have been the most helpful change to have made.
That error reporting would identify if you have an error in statement for connecting to your database for example. You don't yet have a test to see if that works.

You wonder if it is your MySQL version, I doubt it.
I have not lodged the changes in MySQL by version in my memory. Your PHP 7 supports MySQL 5.1 and above, your screenshot from the phpMyAdmin home page shows your PHP has the "mysqli" component for MySQL 5.6, and it shows your database server is running 5.7, You could contact your host and get them to offer more up-to-date PHP components and MySQL components. Actually, it would be best if your host can offer you the latest stable PHP 8.1, and whatever is the latest stable database server.

The bulk of your script after the connect works as your query was tested with my PHP 8.1.14, my MariaDB 10.3.34, and my cumulus database.
Your database is fine, and the new error condition is not triggered.
There are no date handling bugs in the PHP 7.3.33 you are running, so the other change you did make has no effect.

You could simplify your while loop for any future test:

Code: Select all

while($row = $result->fetch_assoc()) {
echo "<th style='border-bottom:2px solid #8f8f8f;'>" . print_r($row) . "</th>";
}
and then you can see what the query does return, assuming the connection $conn is okay.

By the way, for a small file, you don't need to zip it, and readers then don't need to unzip it, just add a ".txt" extension (something like "7dcomphtitcumx.php.txt") and the forum will accept the file.
Last edited by sfws on Sun 08 May 2022 7:44 pm, edited 1 time in total.
griffo42
Posts: 224
Joined: Thu 10 Dec 2015 6:41 am
Weather Station: Davis Vantage Pro2
Operating System: Win 11 Home
Location: Brisbane, Queensland, Australia
Contact:

Re: Rolling Weekly Data - Displaying data on website

Post by griffo42 »

Further to my previous I ran a query direct in PHPMyAdmin.
This is the query:
Screenshot 2022-04-25 190230Select Statement.png
This is the result:
Screenshot 2022-04-25 190430 select result.png
Keith
You do not have the required permissions to view the files attached to this post.
Keith
Davis Vantage Pro2 Model #6152AU - CumulusMX - Win11 - Saratoga/CUMX Default Scripts
https://www.kstwx.net/index.php
https://www.kstwx.net/cumx/index.html
Image
sfws
Posts: 1183
Joined: Fri 27 Jul 2012 11:29 am
Weather Station: Chas O, Maplin N96FY, N25FR
Operating System: rPi 3B+ with Buster (full)

Re: Rolling Weekly Data - Displaying data on website

Post by sfws »

Of course the query works in phpMyAdmin, I said it was not the query in your script that is wrong.

My earlier answers covered my advice.
Last edited by sfws on Sun 08 May 2022 7:51 pm, edited 1 time in total.
griffo42
Posts: 224
Joined: Thu 10 Dec 2015 6:41 am
Weather Station: Davis Vantage Pro2
Operating System: Win 11 Home
Location: Brisbane, Queensland, Australia
Contact:

Re: Rolling Weekly Data - Displaying data on website

Post by griffo42 »

@sfws

Thanks for your effort to try to sort this out for me. Much appreciated. I have posed the problem to my ISP and am presently awaiting its response.

Keith
Keith
Davis Vantage Pro2 Model #6152AU - CumulusMX - Win11 - Saratoga/CUMX Default Scripts
https://www.kstwx.net/index.php
https://www.kstwx.net/cumx/index.html
Image
griffo42
Posts: 224
Joined: Thu 10 Dec 2015 6:41 am
Weather Station: Davis Vantage Pro2
Operating System: Win 11 Home
Location: Brisbane, Queensland, Australia
Contact:

Re: Rolling Weekly Data - Displaying data on website

Post by griffo42 »

@sfws
After quite some effort, I have now sorted tout the problem. It was largely related to including the database table in line 24. Once I deleted that, it basically fell out and worked. Again thanks for your help.

Keith
Keith
Davis Vantage Pro2 Model #6152AU - CumulusMX - Win11 - Saratoga/CUMX Default Scripts
https://www.kstwx.net/index.php
https://www.kstwx.net/cumx/index.html
Image
AndyKF650
Posts: 701
Joined: Thu 20 Aug 2020 8:35 am
Weather Station: Davis VP2 Plus
Operating System: RPiv4 64bit Linux 12 Bookworm
Location: Jersey Channel Islands
Contact:

Re: Rolling Weekly Data - Displaying data on website

Post by AndyKF650 »

I have just set up this file and have managed to get it to work on my website. Since my mysql daydata db is only 1day old the data looks a bit odd but it is a start.

I tried to get it to run as a Cutils UserReport but for some reason it came up with a 2 Connection Failed" error however the same details worked cleanly on my local site. All very odd.

The working data can be seen on the Rolling Data test under the L'Alouette sites tab.
AndyKF650
Posts: 701
Joined: Thu 20 Aug 2020 8:35 am
Weather Station: Davis VP2 Plus
Operating System: RPiv4 64bit Linux 12 Bookworm
Location: Jersey Channel Islands
Contact:

Re: Rolling Weekly Data - Displaying data on website

Post by AndyKF650 »

At last, after a steep learning curve with my network provider, I have managed to get this functionality working. Whilst HostPresto are good service providers their information for MySql newbie users is a bit thin.

I am quite pleased to have got CMX MySql talking to the host and once that happened I could get the .php to work as expected. I then sorted the style issues to get the end result looking similar to my website and then ended up with something I quite like. Certainly I need a few more days to make the 7 day data more meaningful but for now it is good.
You do not have the required permissions to view the files attached to this post.
Mapantz
Posts: 1772
Joined: Sat 17 Dec 2011 11:55 am
Weather Station: Davis Vantage Pro2
Operating System: Windows 11 x64
Location: Dorset - UK
Contact:

Re: Rolling Weekly Data - Displaying data on website

Post by Mapantz »

The 7 days average/trend of high and low pressure looks a bit suspect.. :lol:
Image
AndyKF650
Posts: 701
Joined: Thu 20 Aug 2020 8:35 am
Weather Station: Davis VP2 Plus
Operating System: RPiv4 64bit Linux 12 Bookworm
Location: Jersey Channel Islands
Contact:

Re: Rolling Weekly Data - Displaying data on website

Post by AndyKF650 »

Hi
Please note there is only 4 days data so the average is 4/7 hence looks odd
Mapantz
Posts: 1772
Joined: Sat 17 Dec 2011 11:55 am
Weather Station: Davis Vantage Pro2
Operating System: Windows 11 x64
Location: Dorset - UK
Contact:

Re: Rolling Weekly Data - Displaying data on website

Post by Mapantz »

Even if there was only one day of data, the pressure average wouldn't be that low?
Image
AndyKF650
Posts: 701
Joined: Thu 20 Aug 2020 8:35 am
Weather Station: Davis VP2 Plus
Operating System: RPiv4 64bit Linux 12 Bookworm
Location: Jersey Channel Islands
Contact:

Re: Rolling Weekly Data - Displaying data on website

Post by AndyKF650 »

Hi @mapanz

Having looked at the php file I can see that there is a method of getting the average correct with less than 7 days. Since I only have 5 days data on my daydata db by setting the correct days at the top of the file gives a better average.

I looked at your site and note that you have the current day showing, can I ask just how you achieved this since the dayfile is only updated at the end of the day. I assume that you are not using a version of the monthly file with data coming in every 5 mins or so.
Mapantz
Posts: 1772
Joined: Sat 17 Dec 2011 11:55 am
Weather Station: Davis Vantage Pro2
Operating System: Windows 11 x64
Location: Dorset - UK
Contact:

Re: Rolling Weekly Data - Displaying data on website

Post by Mapantz »

My CMX processes and uploads a file with my own custom PHP webtags, every 15 mins. That contains all of today's data.. :)
Image
sfws
Posts: 1183
Joined: Fri 27 Jul 2012 11:29 am
Weather Station: Chas O, Maplin N96FY, N25FR
Operating System: rPi 3B+ with Buster (full)

Re: Rolling Weekly Data - Displaying data on website

Post by sfws »

AndyKF650 wrote: Thu 12 May 2022 2:00 pm I am quite pleased to have got CMX Sql_connect talking to the host and once that happened I could get the .php to work as expected. .... Certainly I need a few more days to make the 7 day data more meaningful but for now it is good.
AndyKF650 wrote: Thu 12 May 2022 7:54 pm Since I only have 5 days data on my daydata db
Presumably you have realised, Mark's ExportToMySQL utility will populate past days onto your database table, using the same SQL_connect functionality as CMX, so you don't need to wait and wait to have the full 14 days available mentioned by original posting author for even that extreme right hand column to work as he designed?

A further bit of advice, in the early part of any day, including today in average calculations skews any parameter that typically has a diurnal pattern, as you are comparing say one hour or two of data for today (just part of variation pattern) with 24 hours worth of data (the full diurnal pattern) on other days. On my own site, where I do include "today" in means, I weight it by multiplying today's value by fractional number of hours in today, while values for other days are multiplied by 24, and then mean calculated by dividing by total number of hours included rather than number of days included, this gives a far more acceptable answer.
AndyKF650
Posts: 701
Joined: Thu 20 Aug 2020 8:35 am
Weather Station: Davis VP2 Plus
Operating System: RPiv4 64bit Linux 12 Bookworm
Location: Jersey Channel Islands
Contact:

Re: Rolling Weekly Data - Displaying data on website

Post by AndyKF650 »

Hi @sfws

Thanks for the advice and support on this issue, your information together with that of @mapantz hopefully will get this functionality working shortly.
AndyKF650
Posts: 701
Joined: Thu 20 Aug 2020 8:35 am
Weather Station: Davis VP2 Plus
Operating System: RPiv4 64bit Linux 12 Bookworm
Location: Jersey Channel Islands
Contact:

Re: Rolling Weekly Data - Displaying data on website

Post by AndyKF650 »

All done for now, Exporttomysql worked exactly as it says on the title with no problem.

Data is now falling into place and I think the page looks upto standard.
You do not have the required permissions to view the files attached to this post.
Post Reply