I'm trying to read temperature from sensor DHT22 connected to raspberry pi and write it to mysql DB via PHP script.
I'm getting the temperature like this:
$temp = shell_exec('./temp.py');
Script returns number like 45 or 45.7 etc... The same as humidity.. When I echo it in the same script, it works. And the thing, which I cannot pass through is here:
$sql='INSERT INTO values (id, date, time, timestamp, temp, hum) VALUES ("", NOW(), NOW(), NOW(), "$temp", "$hum")';
$result = MySQL_Query($sql);
But in DB is always written $temp and $hum, not the actual values. I think that I've already tried all possible combinations of quotation marks, etc... What can be possibly wrong? Thanks in advance for the answers.