Welcome to the Cumulus Support forum.

Latest Cumulus MX V4 release 4.0.1 (build 4023) - 16 May 2024

Latest Cumulus MX V3 release 3.28.6 (build 3283) - 21 March 2024

Legacy Cumulus 1 release 1.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

a PHP import script for DayFile and Monthly log files

Discussion and support for 3rd-party (non-Sandaysoft) tools for Cumulus
User avatar
daj
Posts: 2041
Joined: Tue 29 Jul 2008 8:00 pm
Weather Station: WH1081
Operating System: Pi & MX
Location: SW Scotland
Contact:

Re: a PHP import script for DayFile and Monthly log files

Post by daj »

nitrx wrote:It doesn't say it's decimal but float (really don't know what it is ..)
Same thing really -- well not technically but it does allow it to hold decimal values. I should probably change it to Decimal but the result would be the same.

I'm looking into how (and if) I can change the regional set for the table

I will drop Kevin (TNET) a PM as I think he is the man who can help here
David
kippfordweather.uk
Cumulus MX & Raspberry Pi
User avatar
nitrx
Posts: 1297
Joined: Sun 13 Dec 2009 1:21 pm
Weather Station: WH1080
Operating System: Windows 10
Location: Apeldoorn The Netherlands
Contact:

Re: a PHP import script for DayFile and Monthly log files

Post by nitrx »

Well ther must be a way to do this but I'm not the expert, hope somebody knows the solution :geek:
User avatar
nitrx
Posts: 1297
Joined: Sun 13 Dec 2009 1:21 pm
Weather Station: WH1080
Operating System: Windows 10
Location: Apeldoorn The Netherlands
Contact:

Re: a PHP import script for DayFile and Monthly log files

Post by nitrx »

I've replaced all the FLOAT in varchar ( 6 ) the values are stored now with decimals (BTW decimal as field did the same as float) my database is filled now with the 'good' values. Probably it can give problems with calculations because it's treated as text now but I'm a little on the right way (the last is well know Japanese saying/proverb 8-)
User avatar
daj
Posts: 2041
Joined: Tue 29 Jul 2008 8:00 pm
Weather Station: WH1081
Operating System: Pi & MX
Location: SW Scotland
Contact:

Re: a PHP import script for DayFile and Monthly log files

Post by daj »

LOL - that's cheating! ;)

I will still see if I can get it stored as a number
David
kippfordweather.uk
Cumulus MX & Raspberry Pi
User avatar
daj
Posts: 2041
Joined: Tue 29 Jul 2008 8:00 pm
Weather Station: WH1081
Operating System: Pi & MX
Location: SW Scotland
Contact:

Re: a PHP import script for DayFile and Monthly log files

Post by daj »

Ok, the word on the street is that MySql can not handle a comma as a decimal separator so the best thing to do is store in a VarChar (basically a non-numeric) field. So Ron your cheat was actually the solution

I also tested doing some basic arithmetic operations on the VarChar field and it worked! :o

I will adjust the code and ask Ron to test it then publish it if all goes well.
David
kippfordweather.uk
Cumulus MX & Raspberry Pi
User avatar
meteotortosa
Posts: 323
Joined: Thu 04 Dec 2008 12:15 am
Weather Station: Davis Vantage Pro2 Plus
Operating System: Windows XP SP3
Location: Tortosa-Baix Ebre- Catalonia
Contact:

Re: a PHP import script for DayFile and Monthly log files

Post by meteotortosa »

I tried it..but it's too hard for me... :oops:
Weather in Tortosa (NE Spain), updated every 15'
Image Image
User avatar
beteljuice
Posts: 3292
Joined: Tue 09 Dec 2008 1:37 pm
Weather Station: None !
Operating System: W10 - Threadripper 16core, etc
Location: Dudley, West Midlands, UK

Re: a PHP import script for DayFile and Monthly log files

Post by beteljuice »

Why not look for and (if necessary) replace delimiter ?
Image
......................Imagine, what you will KNOW tomorrow !
User avatar
nitrx
Posts: 1297
Joined: Sun 13 Dec 2009 1:21 pm
Weather Station: WH1080
Operating System: Windows 10
Location: Apeldoorn The Netherlands
Contact:

Re: a PHP import script for DayFile and Monthly log files

Post by nitrx »

Well all data are imported fine however I don't see the arithmetic operations , I think this was a good lesson for me to start some sql I will try to make a outputpage because I've read almost the half of internet.

It think with some sense almost everybody can figure out the script from David you only have to ftp it and have a mysql database and the possibillity of php on your server.

Going to setup the automatic ftp and the script acces in the toolbox now :!:
User avatar
daj
Posts: 2041
Joined: Tue 29 Jul 2008 8:00 pm
Weather Station: WH1081
Operating System: Pi & MX
Location: SW Scotland
Contact:

Re: a PHP import script for DayFile and Monthly log files

Post by daj »

I'm thinking of trying that, however it's not as easy

Example

in the UK is is 1,234.56
in Europe 1.234,56

So If I say replace comma with . I could end up making a mess of the UK one.

Although I'm not sure Cumulus would ever get to the thousands in a number
David
kippfordweather.uk
Cumulus MX & Raspberry Pi
User avatar
nitrx
Posts: 1297
Joined: Sun 13 Dec 2009 1:21 pm
Weather Station: WH1080
Operating System: Windows 10
Location: Apeldoorn The Netherlands
Contact:

Re: a PHP import script for DayFile and Monthly log files

Post by nitrx »

daj wrote: Although I'm not sure Cumulus would ever get to the thousands in a number
1.021,6 hPa / mb :ugeek:
User avatar
daj
Posts: 2041
Joined: Tue 29 Jul 2008 8:00 pm
Weather Station: WH1081
Operating System: Pi & MX
Location: SW Scotland
Contact:

Re: a PHP import script for DayFile and Monthly log files

Post by daj »

I think I will run away. LOL

I am going out for a few hours and when I get back I will fix the script hopefully
David
kippfordweather.uk
Cumulus MX & Raspberry Pi
n9mfk
Posts: 845
Joined: Sun 10 May 2009 8:52 pm
Weather Station: davis vp2 Serial datalogger
Operating System: Windows 7 64-bit
Location: Springfield, IL

Re: a PHP import script for DayFile and Monthly log files

Post by n9mfk »

Hi David,
i did this
http://www.n9mfk.com/ImportCumulusFile. ... g09log.txt
an got failed to open file
Warning: mysqli_close() expects parameter 1 to be mysqli, resource given in /virtual/users/e15744-16642/web/ImportCumulusFile.php on line 156
what did i miss?
TNETWeather

Re: a PHP import script for DayFile and Monthly log files

Post by TNETWeather »

I've never used mysqli versions of MySQL php functions before so I've never seen that error before.

Reference to your error was something like:
... I had a similar error and it cleared when I added the following code after a successful connection to the database MySQL server and before querying;

mysqli_select_db($link, "dbname");
User avatar
nitrx
Posts: 1297
Joined: Sun 13 Dec 2009 1:21 pm
Weather Station: WH1080
Operating System: Windows 10
Location: Apeldoorn The Netherlands
Contact:

Re: a PHP import script for DayFile and Monthly log files

Post by nitrx »

Hi n9mfk

are you sure that you have given all privileges as user to the database ?

As there are SELECT CREATE INSERT ALTER UPDATE DROP DELETE LOCK TABLES INDEX REFERENCES CREATE TEMPORARY TABLES CREATE ROUTINE
n9mfk
Posts: 845
Joined: Sun 10 May 2009 8:52 pm
Weather Station: davis vp2 Serial datalogger
Operating System: Windows 7 64-bit
Location: Springfield, IL

Re: a PHP import script for DayFile and Monthly log files

Post by n9mfk »

I am new to msql
what how do i make the needed changes
Thanks Beau
Post Reply