Page 1 of 1

Posting to a SQL Database

Posted: Fri Jul 03, 2020 12:42 pm
by ValleyMan
I am trying to post data to an MariaDB SQL database but am having trouble getting the format of the statement correct to recognise the variable from the weather station. I have generated the following SQL string using phpMyAdmin:

INSERT INTO `Weather_Data` (`id`, `time_stamp`, `temp_out`, `hum_out`, `dew_out`, `heat_out`, `temp_in`, `hum_in`, `dew_in`, `pres_stn`, `pres_sea`, `wind`, `wind_ave`, `wind_dir`, `wind_gust`, `wind_chill`, `rain_rate`, `rainfall`, `uv_index`, `solar_rad`, `et`) VALUES (NULL, current_timestamp(),[th0temp:-99.99], NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)

But all it is posting is the Timestamp and -99.99. I have tried including just the variable th0temp: but it just returns a NULL value

I appreciate that this is more of a database issue rather than an issue with the Meteobridge and it might be stupid question as I am new to SQL databases, but any advice would be appreciated.

Many thanks

Ian

Re: Posting to a SQL Database

Posted: Wed Jul 15, 2020 11:06 pm
by ValleyMan
If in doubt read the instructions 😀. I missed the -act from the end of the variable so just a null value was being posted. Weather station data now being posted to my SQL database.