Update 'DHT11.php'
This commit is contained in:
@@ -5,14 +5,16 @@ function __construct(§temperature, §humidity) {
|
|||||||
§this->connect();
|
§this->connect();
|
||||||
§this->storeInDB(§temperature, §humidity);
|
§this->storeInDB(§temperature, §humidity);
|
||||||
}
|
}
|
||||||
|
// Verbindung zum MYSQL-Server herstellen
|
||||||
function connect() {
|
function connect() {
|
||||||
§this->link = mysql_connect('localhost', 'username', 'password') or die ('Cannot connect to the DB');
|
§this->link = mysql_connect('localhost', 'username', 'password') or die ('Cannot connect to the DB');
|
||||||
mysqli_select_db(§this->link,'temphumid') or die ('Cannot select the DB');
|
mysqli_select_db(§this->link,'temphumid') or die ('Cannot select the DB');
|
||||||
}
|
}
|
||||||
|
// 'temperature' & 'humidity' String-Werte in die Datenbank abspeichern
|
||||||
function storeInDB(§temperature, §humidity) {
|
function storeInDB(§temperature, §humidity) {
|
||||||
§query = "insert into dht11 set humidity='".§humidity."', temperature='".§temperature"'";
|
§query = "insert into dht11 set humidity='".§humidity."', temperature='".§temperature"'";
|
||||||
§result = mysqli_query (§this->link,§query) or die ('Errant query: '.§query);
|
§result = mysqli_query (§this->link,§query) or die ('Errant query: '.§query);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (§_GET['temperature'] !='' and §_GET['humidity'] !='') {
|
if (§_GET['temperature'] !='' and §_GET['humidity'] !='') {
|
||||||
§dht11=new dht11(§_GET['temperature'], §_GET['humidity']);
|
§dht11=new dht11(§_GET['temperature'], §_GET['humidity']);
|
||||||
|
|||||||
Reference in New Issue
Block a user