Page 1 of 2
graphWindRose.php
Posted: Tue 05 May 2020 8:16 pm
by richard_newberry
I am getting the following error message when im accessing this link:-
http://desford-weather.co.uk/images/graphWindRose.php
When graphWindRose.php is uncommented in graphSettings.php the error message happens on all graph images.
Any ideas please?
Thanks.
Re: graphWindRose.php
Posted: Tue 05 May 2020 8:19 pm
by freddie
Comma after "AS time" in your SQL query?
Re: graphWindRose.php
Posted: Tue 05 May 2020 10:46 pm
by Mapantz
INTERVAL 24 HOUR ORDE'
*John Bercow voice*
ORDER
Re: graphWindRose.php
Posted: Wed 06 May 2020 1:17 am
by richard_newberry
the code is as follows in graphSettings.php
$query = "SELECT unix_timestamp(LogDateTime) AS time, $cols
FROM Realtime
WHERE LogDateTime >= now() - INTERVAL " .$GRAPH['hours']. " HOUR
ORDER BY time";
#include $GRAPH['jpgraphloc'] . 'jpgraph_windrose.php'; when I uncomment this out my graph images don't work and display the following message.
ERROR - Bad Select Statement: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'FROM Realtime WHERE LogDateTime >= now() - INTERVAL 24 HOUR ORDE' at line 2
SELECT unix_timestamp(LogDateTime) AS time, FROM Realtime WHERE LogDateTime >= now() - INTERVAL 24 HOUR ORDER BY time
when I remove the after "AS Time, as advised this message occurs below
HTTP 500 error
That’s odd… the website can’t display this page
Re: graphWindRose.php
Posted: Wed 06 May 2020 8:54 am
by mcrossley
Your SQL select is wrong, it is missing the column name..
Code: Select all
SELECT unix_timestamp(LogDateTime) AS time, FROM Realtime WHERE LogDateTime >= now() - INTERVAL 24 HOUR ORDER BY time
Should be...
Code: Select all
SELECT unix_timestamp(LogDateTime) AS time, bearing, wspeed FROM Realtime WHERE LogDateTime >= now() - INTERVAL 24 HOUR ORDER BY time
The columns are defined in graphWindRose.php at line 22...
Code: Select all
$w1 = get_data(array('bearing', 'wspeed'));
Re: graphWindRose.php
Posted: Wed 06 May 2020 8:57 pm
by richard_newberry
Thanks Mark,
Do I need ; at the end of the line $query = SELECT unix_timestamp(LogDateTime) AS time, bearing, wspeed FROM Realtime WHERE LogDateTime >= now() - INTERVAL 24 HOUR ORDER BY time
PHP Parse error: syntax error, unexpected 'unix_timestamp' (T_STRING) in /var/www/images/graphSettings.php on line 140
PHP Parse error: syntax error, unexpected ']', expecting '-' or identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) in /var/www/images/graphSettings.php on line 151
line 151 is code:- $keys[] = $flds[$i]->name;
in file WindRose.php is this code ok now?
//fetch the data
$w1 = get_data(array('bearing', 'wspeed'));
$w2 = get_data('wind');
$datay = $w1['bearing'];
//$datay1 =$w2['wspeed'];
$datay1 =$w2['wgust'];
Any ideas cheers.
Re: graphWindRose.php
Posted: Thu 07 May 2020 10:42 am
by richard_newberry
I am so close,
http://desford-weather.co.uk/gauges-ss.htm
following errors in apache2/error.log
PHP Warning: Division by zero in /var/www/jpgraph/jpgraph_windrose.php on line 140
PHP Fatal error: Uncaught Error: Class 'WindroseGraph' not found in /var/www/jpgraph/jpgraph_windrose.php:149\nStack trace:\n#0 /var/www/images/graphSettings.php(42): include()\n#1 /var/www/images/graphSolar.php(14): require_once('/var/www/images...')\n#2 {main}\n thrown in /var/www/jpgraph/jpgraph_windrose.php on line 149
Invalid argument supplied for foreach() in /var/www/images/graphSettings.php on line 131, referer:
http://desford-weather.co.uk/images/
Re: graphWindRose.php
Posted: Thu 07 May 2020 11:32 am
by richard_newberry
I have included the files and the apache2 error file which could fix this problem?
I had to rename the jpgraph_windrose.php to txt because the extension isn't allowed on this forum.
please upload a fix if anyone knows how to fix the Windrose I would really would like to fix this problem.
I have no idea why the 2 temperature gauges have a ? before C
http://desford-weather.co.uk/gauges-ss.htm
Re: graphWindRose.php
Posted: Fri 08 May 2020 12:40 am
by beteljuice
I have no idea why the 2 temperature gauges have a ? before C
At some point gauges.js has been edited and saved but
NOT in
UTF-8 format.
Best to get a fresh copy to edit ....
EDIT: Your posted jpgraph_windrose.php is nothing like what it should be

Re: graphWindRose.php
Posted: Fri 08 May 2020 9:25 am
by richard_newberry
I copied it from Marks github site then pasted it.
Re: graphWindRose.php
Posted: Fri 08 May 2020 11:01 am
by sfws
Yes but into what did you paste?
I am guessing it was not a file set up with UTF-8 encoding.
Use notepad++ or similar editor that lets you choose encoding before you paste in.
Re: graphWindRose.php
Posted: Fri 08 May 2020 1:56 pm
by richard_newberry
I used winscp on windows
Re: graphWindRose.php
Posted: Fri 08 May 2020 2:52 pm
by beteljuice
One thing at a time ...
Here's the correct jpgraph_windrose.php file.
jpgraph_windrose.zip
Note it is 'zipped', any file that is not a native .txt file or graphic you should zip before posting as an attachment
(Usually 'browse' your file folder, select, and <right-click> - send to ... zip)
I haven't got an 'unspoilt' gauges.js to donate - sorry
For editing files the weapon of choice is
Notepad++
It will usually auto detect the script language, and the encoding (ANSI / UTF-8 etc.)
'Ordinary' notepad, or cut'n'paste from view-source can create all sorts of problems for the unwary - so always look for a zip download or 'raw' file (noting charset with the later)
If you still have problems will the degree symbol (after ensuring gauges.js is OK), then check the method it is being UPloaded to your web space.
Re: graphWindRose.php
Posted: Fri 08 May 2020 3:32 pm
by richard_newberry
Thank you
Re: graphWindRose.php
Posted: Fri 08 May 2020 9:04 pm
by richard_newberry
Hi beteljuice,
Thank you very much for sorting the jpgraph_windrose.php file out for me.
I have done the gauges.js and saved it under notepad++ as advised and it works thank you.
However now I have this problem.
I have Verdana.ttf under /var/www/jpgraph/fonts/ on permission 0644 like the other files in the folder.
Any idea, nearly there.