Sandaysoft

Support forum for Cumulus weather station software
It is currently Wed Jun 19, 2013 6:30 pm
Please click here before posting. Help me to help you!
Useful Links: Cumulus FAQ • Enhancement requests • Wiki (documentation)
Please put your approximate location into your profile
Add your web site to the Cumulus user map
Vantage Pro2 users with firmware 3.00 should upgrade to fw 3.12 and Cumulus 1.9.4

All times are UTC




Post new topic Reply to topic  [ 28 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Display data from SQL in a table on your website
PostPosted: Thu Feb 04, 2010 11:50 pm 
Offline
User avatar

Joined: Tue Jul 29, 2008 8:00 pm
Posts: 2001
Location: Thornhill, Dumfries, UK
Weather Station: WH1081
Operating System: Mac OSx & Win 7
A number of people have asked how I do this on my site...

http://www.grantownweather.co.uk/historic/historic.php

Basically I am reading my dayfile.txt which I have stored in an SQL database on my webserver (see my other post on this). I then extract this data from SQL using PHP and show it in a table on my web pages.

There is a lot involved in doing this and many files (several javascript, styles sheets, images, PHP) It's a complicated process so is not for a beginner.

You need to edit dbconfig.php and look (and edit) historic.php, which calls read_dayfile.php (nothing needs editing in there as I have done all the work)

You can download all the files needed here.....http://www.grantownweather.co.uk/historic/DataTable.zip I think I have included everything!

Good luck

_________________
David
Contact Me


Top
 Profile  
 
 Post subject: Re: Display data from SQL in a table on your website
PostPosted: Fri Feb 05, 2010 8:14 am 
Offline

Joined: Sun Dec 13, 2009 1:21 pm
Posts: 882
Location: Apeldoorn The Netherlands
Weather Station: WH1080 / WS 4000
Operating System: Windows 7 / Ubuntu
Great I just posted mine :D , but I think yours is more sophisticated something to play this weekend

_________________
Ron

Image

Apeldoorn, The Netherlands


Top
 Profile  
 
 Post subject: Re: Display data from SQL in a table on your website
PostPosted: Fri Feb 05, 2010 9:27 am 
Offline

Joined: Sun Dec 13, 2009 1:21 pm
Posts: 882
Location: Apeldoorn The Netherlands
Weather Station: WH1080 / WS 4000
Operating System: Windows 7 / Ubuntu
In the dbconfig.php a wrong table is requested

Quote:
the name of the SQL table holding the dayfile
$table_name="dayfile";

?>


I've changed the dayfile to Dayfile because thats the table where de data are stored (I got empty fields with the lowercase)

_________________
Ron

Image

Apeldoorn, The Netherlands


Top
 Profile  
 
 Post subject: Re: Display data from SQL in a table on your website
PostPosted: Fri Feb 05, 2010 9:31 am 
Offline
User avatar

Joined: Tue Jul 29, 2008 8:00 pm
Posts: 2001
Location: Thornhill, Dumfries, UK
Weather Station: WH1081
Operating System: Mac OSx & Win 7
The name of the table is whatever you called it when you imported it, so if yours is "Dayfile" then that is what this setting must be, whereas mine is actually called something complete different ;)

_________________
David
Contact Me


Top
 Profile  
 
 Post subject: Re: Display data from SQL in a table on your website
PostPosted: Fri Feb 05, 2010 9:35 am 
Offline

Joined: Sun Dec 13, 2009 1:21 pm
Posts: 882
Location: Apeldoorn The Netherlands
Weather Station: WH1080 / WS 4000
Operating System: Windows 7 / Ubuntu
Yep thats no surprise for me :) Well I need coffee right now

_________________
Ron

Image

Apeldoorn, The Netherlands


Top
 Profile  
 
 Post subject: Re: Display data from SQL in a table on your website
PostPosted: Fri Feb 05, 2010 9:37 am 
Offline
User avatar

Joined: Tue Jul 29, 2008 8:00 pm
Posts: 2001
Location: Thornhill, Dumfries, UK
Weather Station: WH1081
Operating System: Mac OSx & Win 7
It's not the weekend yet, so why are you playing with this? LOL

You said you would play with it at the weekend :lol:

_________________
David
Contact Me


Top
 Profile  
 
 Post subject: Re: Display data from SQL in a table on your website
PostPosted: Fri Feb 05, 2010 9:49 am 
Offline

Joined: Sun Dec 13, 2009 1:21 pm
Posts: 882
Location: Apeldoorn The Netherlands
Weather Station: WH1080 / WS 4000
Operating System: Windows 7 / Ubuntu
I planned a trip to Australia it's weekend over there ;)

_________________
Ron

Image

Apeldoorn, The Netherlands


Top
 Profile  
 
 Post subject: Re: Display data from SQL in a table on your website
PostPosted: Fri Feb 05, 2010 5:15 pm 
Offline

Joined: Sun May 10, 2009 8:52 pm
Posts: 508
Location: Springfield, IL
Weather Station: davis vp2 Serial datalogger
Operating System: Windows 7 64-bit
Hi All,
were do i change from c deg to f deg

http://www.n9mfk.com/historic/
Thanks Beau


Top
 Profile  
 
 Post subject: Re: Display data from SQL in a table on your website
PostPosted: Fri Feb 05, 2010 6:10 pm 
Offline

Joined: Sun Dec 13, 2009 1:21 pm
Posts: 882
Location: Apeldoorn The Netherlands
Weather Station: WH1080 / WS 4000
Operating System: Windows 7 / Ubuntu
You already diid it I suppose ?

_________________
Ron

Image

Apeldoorn, The Netherlands


Top
 Profile  
 
 Post subject: Re: Display data from SQL in a table on your website
PostPosted: Fri Feb 05, 2010 7:30 pm 
Offline

Joined: Sun May 10, 2009 8:52 pm
Posts: 508
Location: Springfield, IL
Weather Station: davis vp2 Serial datalogger
Operating System: Windows 7 64-bit
Hi Ron,
I found an had delete to post but it did not delete
Beau


Top
 Profile  
 
 Post subject: Re: Display data from SQL in a table on your website
PostPosted: Mon Feb 08, 2010 12:58 am 
Offline
User avatar

Joined: Wed Oct 21, 2009 11:19 am
Posts: 280
Location: Bayswater, Australia
Weather Station: La Crosse WS-2355
Operating System: Windoze 7
Hi David.

I've implemented your excellent MySQL history table with a fair degree of success.

Two points are worth a mention.

The first, regarding the 'colnames' definition. Is there any alternative to using <br/> to insert a line-feed in those headings which require two lines?
The xhtml spec says that <br/> isn't allowed. Not that it matters much to most browsers, though.

My second comment relates to dayfile.txt.
Lines in dayfile.txt since the Cumulus release which added 'Highest Average Wind Speed' and 'Time of Highest Average Wind Speed' are longer by 2 values.
This caused MySQL v5.1.43 to only use the most recent (longer) lines and then report errors for all the rest, having been told to expect 18 values, but only getting 16).
I added 2 dummy values (, 0.0, 00:00) to the end of all the short lines in my dayfile.txt (fortunately my history only goes back to late October).
It works ok, but I don't know if it's good for the longer term.

Cheers

_________________
Graeme.
http://weather.gktnet.com/cumulus/index.htm
Image


Top
 Profile  
 
 Post subject: Re: Display data from SQL in a table on your website
PostPosted: Mon Feb 08, 2010 1:20 am 
Offline
User avatar

Joined: Wed Sep 17, 2008 1:34 pm
Posts: 629
Location: Mesa, AZ USA
Weather Station: Davis VP2 Plus w/24 FARS
Operating System: WinX Pro SP3 Dedicated wstn
If you remove the <br/>'s what do you get. I suspect you will see what you want. Unless you use a &nbsp; with no spaces, the col headers are going to break due to the width of the columns anyway.

_________________
Kevin
Image
All you need is Time, Aptitude and Desire ... and you can build just about anything...
Cumulus User Maps


Top
 Profile  
 
 Post subject: Re: Display data from SQL in a table on your website
PostPosted: Mon Feb 08, 2010 4:59 am 
Offline
User avatar

Joined: Wed Oct 21, 2009 11:19 am
Posts: 280
Location: Bayswater, Australia
Weather Station: La Crosse WS-2355
Operating System: Windoze 7
Hi Kevin,

First up, this is daj's code, not mine, I'm just making use of it.

Removing the <br/>'s stops the text wrapping around to the next line within the cell.
Using &nbsp; or a space doesn't cause a break, the text just disappears from view off to the right.
<br /> seems to be the only way to break the lines, but w3c validation fails at each occurrence in this case.
I suspect it's something in the way jquery operates, but I'll be the first to admit I have a LOT to learn
about php, javascript and mysql, (until 3 days ago I'd never used MySQL)
so if I've missed something here, let me know....

The pages below show what I mean.
The first page is the original history.php using <br/> and the second has spaces.
As you'll see, the second page doesn't have quite the same appearance.

http://weather.gktnet.com/history/historic.php

http://weather.gktnet.com/history/historic_.php

_________________
Graeme.
http://weather.gktnet.com/cumulus/index.htm
Image


Top
 Profile  
 
 Post subject: Re: Display data from SQL in a table on your website
PostPosted: Mon Feb 08, 2010 5:20 am 
Offline
User avatar

Joined: Wed Sep 17, 2008 1:34 pm
Posts: 629
Location: Mesa, AZ USA
Weather Station: Davis VP2 Plus w/24 FARS
Operating System: WinX Pro SP3 Dedicated wstn
Was just a thought. With normal cols in a table it would work, but I just tried doing it with your page and got the results you mentioned.

He is using JavaScript in the header section to deal with sorting etc... I suspect that it could be adjusted via CSS, but not really sure. He would be better and knowing what is going on.

_________________
Kevin
Image
All you need is Time, Aptitude and Desire ... and you can build just about anything...
Cumulus User Maps


Top
 Profile  
 
 Post subject: Re: Display data from SQL in a table on your website
PostPosted: Mon Feb 08, 2010 9:40 pm 
Offline
User avatar

Joined: Tue Jul 29, 2008 8:00 pm
Posts: 2001
Location: Thornhill, Dumfries, UK
Weather Station: WH1081
Operating System: Mac OSx & Win 7
Hi Graeme

GraemeT wrote:
The first, regarding the 'colnames' definition. Is there any alternative to using <br/> to insert a line-feed in those headings which require two lines?
The xhtml spec says that <br/> isn't allowed. Not that it matters much to most browsers, though.

There are a number of possible solutions -- I have had limited success with CSS. A quick 'cheat' to pass the XHTML spec is to move the Javascript to it's own file. So copy all the text between the last <script> and </script> but not the two tags, save it, then call it from within the document...<script src="build-table.js" type="text/javascript"></script>

To fully comply you need to 'fix' the blank table that is defined further down. I currently have a table with nothing in it and the Jquery fills it later. However XHML will not pass this so you would need to change it to include a row and a data cell...<table id="list"><tr><td></td> </tr></table>

It will now pass ;-) as mine does!



Quote:
My second comment relates to dayfile.txt.
Lines in dayfile.txt since the Cumulus release which added 'Highest Average Wind Speed' and 'Time of Highest Average Wind Speed' are longer by 2 values.
This caused MySQL v5.1.43 to only use the most recent (longer) lines and then report errors for all the rest, having been told to expect 18 values, but only getting 16).
I added 2 dummy values (, 0.0, 00:00) to the end of all the short lines in my dayfile.txt (fortunately my history only goes back to late October).
It works ok, but I don't know if it's good for the longer term.

That is strange, as my dayfile.txt, like so many, will start off with the two fields missing at the end and then they appear after they were added to Cumulus. However they import no problem and are assigned no values. The script does not actually care how may fields it imports (I did that on purpose), but it then creates 18 and if there is no value in a field in the array it will be blank

Can you send me your dayfile just to try on my version (5.1.30)

_________________
David
Contact Me


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 28 posts ]  Go to page 1, 2  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Protected by Anti-Spam ACP Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group