Page 1 of 1

Additional table to my SQL database

Posted: Sun 01 Jan 2023 4:46 pm
by pkiener
I am attempting to add another table to my SQL database, housed on my web server. I already have the programs default tables "Dayfile", "Monthlly" and "Realtime" work and are uploading correctly. My new table "daylength" have the following columns: "Date", "Daylength", "Moonrise", "Moonset", "Sunrise", and "Sunset". I am using the following SQL statement, in the section "Custom upload - at rollover": INSERT IGNORE INTO daylength (Date, Sunrise, Sunset, Daylength, Moonrise, Moonset) VALUES ('<#date>', '<#sunrise>', '<#sunset>', '<#daylength>', '<#moonrise>', '<#moonset>');

Values are correct, except for the date. I am seeing 00/00/0000. What am I doing wrong?

Thank you for any help!
Paul
weather.paulkiener.com

Re: Additional table to my SQL database

Posted: Sun 01 Jan 2023 4:51 pm
by Mapantz
You need a LogDate

INSERT IGNORE INTO <table name> (LogDate,<column name>)

Re: Additional table to my SQL database

Posted: Sun 01 Jan 2023 5:10 pm
by pkiener
Thank you for the quick reply! I have now changed my statement to:
INSERT IGNORE INTO daylength (LogDate, Sunrise, Sunset, Daylength, Moonrise, Moonset) VALUES ('<#logdate>', '<#sunrise>', '<#sunset>', '<#daylength>', '<#moonrise>', '<#moonset>');

I'll have to wait until tomorrow to see if it works, unless there is another way to test sooner.

Thank you!
Paul
weather.paulkiener.com

Re: Additional table to my SQL database

Posted: Sun 01 Jan 2023 5:11 pm
by mcrossley
You said the column name was "date" though not LogDate?

I think you need to apply a format to the date that the database understands. So normally YYYY-MM-DD...
<#date format=yyyy-MM-dd>

Re: Additional table to my SQL database

Posted: Sun 01 Jan 2023 5:24 pm
by pkiener
Thank you, Mark. I did mention earlier that the header name was "Date". I changed it to "LogDate" from the earlier response. So now I have the following statement:
INSERT IGNORE INTO daylength (LogDate, Sunrise, Sunset, Daylength, Moonrise, Moonset) VALUES ('<#date format=yyyy-MM-dd>', '<#sunrise>', '<#sunset>', '<#daylength>', '<#moonrise>', '<#moonset>');

We'll see how this works.

Paul
weather.paulkiener.com

Re: Additional table to my SQL database

Posted: Mon 02 Jan 2023 5:12 am
by pkiener
Many thanks, Mark. Your suggestion was spot on and worked as I hoped. Thanks again and Happy New Year!

Paul
weather.paulkiener.com