Page 15 of 15

Re: Top 10 Records Page

Posted: Wed 15 Aug 2018 3:55 am
by Hunter362
I know this is an old thread, but am moving my server to Ubuntu 16.04, with php 7
am having a heck of a time reading anything from my Mysql Database.

ERROR - Bad Select Statement (1) -
SELECT LogDate, ROUND(HeatDegDays, 1), Logdate >= DATE_SUB('2018-08-13', INTERVAL 32 DAY) FROM DayfileMX WHERE HeatDegDays IS NOT NULL ORDER BY HeatDegDays DESC, LogDate ASC LIMIT 10
Unknown column 'HeatDegDays' in 'field list'

The above query works fine and displays what it should in phpmyadmin, but on mark's most recent Top10 script thats the error I get.

Re: Top 10 Records Page

Posted: Wed 15 Aug 2018 7:37 pm
by mcrossley
Do all the queries up to that point work OK?

Re: Top 10 Records Page

Posted: Thu 16 Aug 2018 1:33 am
by Hunter362
Hi Mark,
It has to be the different mysql version's, not just your script.
My site is currently running Ubuntu 14.04 - mysql v 5.5.61
New server is runing Ubuntu 16.04 - mysql v 5.7.23

It seems to be the change in mysql query's and such, changes from "mysql" to "mysqli" and other's, there's a whole bunch
of different things in your most recent Top10 page, then the one I'm currently using, 0.17
I only have a couple scripts that use the mysql datbase, your Top10 and a previous year's one that I cobbled together,
if you saw it you'd laugh! php or mysql guru I'm not, but I can usually make it work eventually, just hoping that you had a somewhat
easier fix.
P.S. I am able to log into the server fine using the script, I had to add a $table_name parm as you have, it has to be the select and display and such.

Import Cumulus v 3.0
Running from web server
Script start: 15/08/18 - 21:50:22
Importing file: dayfile.txt, To table: Dayfile ...
Connected to database OK.
Set MySQL TZ OK.
Processing dayfile...
Target table already exists.
ERROR - Failed to prepare the insert statement: Dayfile, error: Unknown column 'HighHeatInd' in 'field list'
INSERT IGNORE INTO Dayfile (LogDate,HighWindGust,HWindGBear,THWindG,MinTemp,TMinTemp,MaxTemp,TMaxTemp,MinPress,TMinPress,MaxPress,TMaxPress,MaxRainRate,TMaxRR,TotRainFall,AvgTemp,TotWindRun,HighAvgWSpeed,THAvgWSpeed,LowHum,TLowHum,HighHum,THighHum,TotalEvap,HoursSun,HighHeatInd,THighHeatInd,HighAppTemp,THighAppTemp,LowAppTemp,TLowAppTemp,HighHourRain,THighHourRain,LowWindChill,TLowWindChill,HighDewPoint,THighDewPoint,LowDewPoint,TLowDewPoint,DomWindDir,HeatDegDays,CoolDegDays,HighSolarRad,THighSolarRad,HighUV,THighUV,HWindGBearSym,DomWindDirSym) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
End.

Re: Top 10 Records Page

Posted: Thu 16 Aug 2018 6:41 pm
by mcrossley
Ah, so it's the importcumulus script that had the error, not the top 10s. I recommend you use the last 2.x version, rather than 3.x as that seems to have issues for some people that I haven't got to the bottom of yet. But it looks like your tables were defined some time ago and new columns have been added since.
Just add the new columns using phpmyadmin

Re: Top 10 Records Page

Posted: Thu 16 Aug 2018 8:06 pm
by Hunter362
Sorry, I should have said the ImportCumulus file does the same thing, I'll try an earlier version and see if it works, I still get the error with the Top10
but I believe it's the newer (for me) mysql 5.7
** Edit: for the record ImportCumulus V.27 worked as it should, thanks for the advice. **

ERROR - Bad Select Statement (1) -
SELECT LogDate, ROUND(HeatDegDays, 1), Logdate >= DATE_SUB('2018-08-15', INTERVAL 32 DAY) FROM Dayfile1 WHERE HeatDegDays IS NOT NULL ORDER BY HeatDegDays DESC, LogDate ASC LIMIT 10
Unknown column 'HeatDegDays' in 'field list'

Above is the error from v 0.17
This is from v 2.1 using a different named database, same (dayfile data) just the one written directly by MX

ERROR - Bad Select Statement (4) -Expression #2 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column 'weather.DayfileMX.LogDate' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by