Page 2 of 9
Re: a PHP import script for DayFile and Monthly log files
Posted: Thu 04 Feb 2010 1:10 pm
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
Re: a PHP import script for DayFile and Monthly log files
Posted: Thu 04 Feb 2010 1:37 pm
by nitrx
Well ther must be a way to do this but I'm not the expert, hope somebody knows the solution

Re: a PHP import script for DayFile and Monthly log files
Posted: Thu 04 Feb 2010 2:20 pm
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

Re: a PHP import script for DayFile and Monthly log files
Posted: Thu 04 Feb 2010 2:42 pm
by daj
LOL - that's cheating!
I will still see if I can get it stored as a number
Re: a PHP import script for DayFile and Monthly log files
Posted: Thu 04 Feb 2010 4:13 pm
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!
I will adjust the code and ask Ron to test it then publish it if all goes well.
Re: a PHP import script for DayFile and Monthly log files
Posted: Thu 04 Feb 2010 5:04 pm
by meteotortosa
I tried it..but it's too hard for me...

Re: a PHP import script for DayFile and Monthly log files
Posted: Thu 04 Feb 2010 6:09 pm
by beteljuice
Why not look for and (if necessary) replace delimiter ?
Re: a PHP import script for DayFile and Monthly log files
Posted: Thu 04 Feb 2010 6:10 pm
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

Re: a PHP import script for DayFile and Monthly log files
Posted: Thu 04 Feb 2010 6:12 pm
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
Re: a PHP import script for DayFile and Monthly log files
Posted: Thu 04 Feb 2010 6:17 pm
by nitrx
daj wrote:
Although I'm not sure Cumulus would ever get to the thousands in a number
1.021,6 hPa / mb

Re: a PHP import script for DayFile and Monthly log files
Posted: Thu 04 Feb 2010 6:19 pm
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
Re: a PHP import script for DayFile and Monthly log files
Posted: Thu 04 Feb 2010 7:57 pm
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?
Re: a PHP import script for DayFile and Monthly log files
Posted: Thu 04 Feb 2010 8:15 pm
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");
Re: a PHP import script for DayFile and Monthly log files
Posted: Thu 04 Feb 2010 8:17 pm
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
Re: a PHP import script for DayFile and Monthly log files
Posted: Thu 04 Feb 2010 9:17 pm
by n9mfk
I am new to msql
what how do i make the needed changes
Thanks Beau