Page 2 of 2

Re: Display data from SQL in a table on your website

Posted: Tue 09 Feb 2010 4:21 am
by GraemeT
Thanks David, I'll try that. Just a bit frustrating to get everything compliant and then find
something that works ok but doesn't comply because of the vagaries of html!
I think my main trouble is I don't understand why <br /> isn't allowed in this instance.
W3C doesn't make it clear to me at all...

Here are links to my original and current dayfile:

Original without fields 17&18:
http://weather.gktnet.com/data/dayfile%20-%20copy.txt

New file with fields 17&18 added and filled with dummy values:
http://weather.gktnet.com/data/dayfile.txt

It doesn't really matter from my perspective now, as I've filled in the values for all the dates prior to 25-Jan-10,
but others may have the same problem and they might have a longer dayfile.txt

Bye for now.

Re: Display data from SQL in a table on your website

Posted: Tue 09 Feb 2010 9:23 am
by daj
GraemeT wrote:Thanks David, I'll try that. Just a bit frustrating to get everything compliant and then find
something that works ok but doesn't comply because of the vagaries of html!
I think my main trouble is I don't understand why <br /> isn't allowed in this instance.
W3C doesn't make it clear to me at all...
Originally I thought it was because I was using formatting tags in the <head> section, however I moved the script into the <body> section and still had the same issue. W3C certainly does not make it clear why it is not allowed. I can replace the <br/> with <span> and then use CSS to display in blocks, but again it gets rejected. To be honest, it is better not to have script in the HTML -- far better to call it from a file anyway. I only included it in the HTML to try and keep things as simple as I could as part of the package
It doesn't really matter from my perspective now, as I've filled in the values for all the dates prior to 25-Jan-10,
but others may have the same problem and they might have a longer dayfile.txt
It's odd, as I have seen several installations now and none have had this problem :? My day file has 540 entires and only about 15 of the new longer line and it was ok. I will have a look at yours later, out of interest.

Re: Display data from SQL in a table on your website

Posted: Tue 09 Feb 2010 10:59 am
by GraemeT
A revelation!

Out of interest I tried enclosing the offending line as below:

Code: Select all

// <![CDATA[
    colNames:['Date','Highest<br/>Gust<br/>(mph)','Wind<br/>Bearing','Time of<br/>Gust','Min. Temp<br/>(&deg;C)','Time of<br/>Min.','Max. Temp<br/>(&deg;C)','Time of<br/>Max.','Avg. Temp<br/>(&deg;C)','Lowest<br/>pressure<br/>(mb)','Time of<br/>Min.','Highest<br/>pressure<br/>(mb)','Time of<br/>high','Highest<br/>Rain rate<br/>(mm/hr)','Time of<br/>High Rate','Total Rain<br/>fall (mm)','Tot.Wind<br/>run'],
// ]]>
Job's right! The javascript parser ignores the CDATA term as it's commented out and the XML parser ignores the line enclosed by the CDATA term - no more errors from the <br/> tags.
I don't understand why it has to be commented out with // but if not, the script doesn't display the table.

More info here:
http://www.w3schools.com/XML/xml_cdata.asp
and here:
http://msdn.microsoft.com/en-us/library/ms256076.aspx

Something else which came to light about 5 minutes ago:

Code: Select all

<table id="list"></table>
<div id="pager"></div> 
</div>
causes an unfinished tag error as the table wants row and cell tags as below:

Code: Select all

<table id="list"><tr><td></td></tr></table>
<div id="pager"></div> 
</div>
which fixes the error.


That's it for me. Going off to do something else for a while...

Re: Display data from SQL in a table on your website

Posted: Tue 09 Feb 2010 3:28 pm
by n9mfk
Hi David,
is there away to do this with out js
Beau

Re: Display data from SQL in a table on your website

Posted: Tue 09 Feb 2010 3:34 pm
by daj
Is there life without JS?! LOL

I could probably do it in PHP

Curious -- why not JS?

Re: Display data from SQL in a table on your website

Posted: Tue 09 Feb 2010 4:24 pm
by n9mfk
Hi David,
I have a friend that uses my site with his screen reader
it does like js so that page can not be read
Beau

Re: Display data from SQL in a table on your website

Posted: Tue 09 Feb 2010 7:53 pm
by n9mfk
Hi David
I us inHG on my davis station for my pressure what wood i need to change to show 3 digits after the point im not sure what file to change?
Thanks Beau

Re: Display data from SQL in a table on your website

Posted: Tue 09 Feb 2010 8:10 pm
by daj
n9mfk wrote:Hi David
I us inHG on my davis station for my pressure what wood i need to change to show 3 digits after the point im not sure what file to change?
Thanks Beau
It's actually the import you will need to adjust, not the table that displays it.

Edit the ImportCumulusFile.php file and look for the line starting...
(should be line 100)

Code: Select all

$CreateQuery="CREATE TABLE " . $table_name . " (LogDate date NOT NULL ,HighWindGust decimal(4,1)........
Quite far along the line change the MinPress decimal(6,2) to (7,3) same for MaxPress a little further along

For consistency, also change line 107...

Change ...Pressure decimal(6,2) to (7,3)

Delete your SQL table and re-import so that it creates the table again

Re: Display data from SQL in a table on your website

Posted: Wed 10 Feb 2010 9:04 pm
by daj
n9mfk wrote:is there away to do this with out js
Beau

Kevin has done us proud.....

https://cumulus.hosiene.co.uk/viewtopic.php?f=14&t=2419

Re: Display data from SQL in a table on your website

Posted: Sun 14 Feb 2010 1:29 pm
by Hillbilly
David,

This is now up and running. Thanks very much for producing it. It has worked a treat. :clap:

Re: Display data from SQL in a table on your website

Posted: Tue 14 Dec 2010 11:03 pm
by gismoat
Hi all,

i have uploadet all files via FTP to my webspace.
dbconfic.php is setup with my login data.

1.) how can i create a dayfile.txt ?
2.) wen i use the read_dayfile i become an error!

=> Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /var/www/web10/html/wetter/read_dayfile.php on line 25
Couldn't execute query.You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 2

URL to my weather files is http://arbeiter4ever.com/wetter/

Please help me.
thanks
GismoAT

Re: Display data from SQL in a table on your website

Posted: Wed 15 Dec 2010 8:35 pm
by daj
You need to get your dayfile.txt (created by Cumulus) into your SQL DB. You can do this yourself or use a script to do it

https://cumulus.hosiene.co.uk/viewtopic.php?f=18&t=2367

Re: Display data from SQL in a table on your website

Posted: Wed 22 Dec 2010 7:30 pm
by gismoat
Hi,
the script is working good. But i have a question.
How can i change the table size?
I will include the Historic page to my homepage but the aktual table size is to big.
thanks
GismoAT