Annex and MySQL

Place code snippets and demo code here
Post Reply
User avatar
Fernando Perez
Posts: 106
Joined: Mon Feb 15, 2021 10:09 pm
Location: Santander (Spain)
Has thanked: 55 times
Been thanked: 54 times

Annex and MySQL

Post by Fernando Perez »

I am experimenting with MySQL databases and PHP web pages.
I found this: [External Link Removed for Guests] and have applied it to Annex.
In the folder of my domain [External Link Removed for Guests] I have uploaded the files that I attach so that you can examine them in case they interest you:
[External Link Removed for Guests]

In my MySQL manager I have created a table using the following query:

Code: [Local Link Removed for Guests]

CREATE TABLE Sensores (
    id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    sensor VARCHAR(1) NOT NULL,
    room VARCHAR(30) NOT NULL,
    type VARCHAR(1),
    value VARCHAR(10),
    reading_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
)
And the code to load in any ESP8266 or ESP32 that you have on hand is this:

Code: [Local Link Removed for Guests]

serverName$ = "https://www.myrapidq.it/php/"
apiKey$ = "x25TyxCCv7JPk"
sensor$ = "0"
room$ = "Dormitorio"
type$ = "L"
value$ = "223"

body$ = "api_key="+apiKey$+"&sensor="+sensor$+"&room="+room$+"&type="+type$+"&value="+value$
wlog WPOST$(serverName$, body$, 1)

Now I wanted to ask you to load it yourself, change the variables as you want (room$ for example, your name) and run it a few times to see if it works correctly for you.
The uploaded data should be seen at [External Link Removed for Guests]
Thanks a lot.
Post Reply