Ansicht:   

#455337 php mysql, oh der schlauch ist lang - immer noch (web.coding)

verfaßt von MagicBird, Berlin, 17.07.2022, 11:46:38

> Hallo Forum,
>
> meine rf_receive.php hat immer noch das Problem beim Update vom status mit
> dem offcode.
>
>


> <?php
> 
> include "error.php";
> require_once '../include/config.include.php';
> require_once '../include/mysql_connect.include.php';
> require_once '../include/mqtt_connect.include.php';
> require_once '../include/date_time.include.php';
> 
> require "../vendor/autoload.php";
> 
> if ($_GET['rxcode'] == true) {
> $statement = $pdo->prepare("SELECT * FROM $controltbl WHERE oncode =
> :oncode OR offcode = :offcode");
> $statement->execute(array('oncode' => $_GET['rxcode'], 'offcode' =>
> $_GET['rxcode']));
> $anzahl_user = $statement->rowCount();   
> while($row = $statement->fetch()) {
> if ($_GET['rxcode'] == $row['oncode']) {
> $mqtt = new \PhpMqtt\Client\MQTTClient($server, $port, $clientId);
> $mqtt->connect();
> $mqtt->publish($row['mqtt_msg'] ,$row['mqtt_status_on'] ,
> $row['mqtt_qos']);
> $mqtt->close();
> $sql = "UPDATE $controltbl SET status = '1' WHERE oncode =
> ".$_GET['rxcode']."";
> $pdo->exec($sql);
> $sql = "INSERT INTO $recievedtbl (id, codecs, date, time) VALUES
> (NULL, '".$_GET['rxcode']."', '$date', '$time')";
> $pdo->exec($sql);
> print "1";
> }
> else if ($_GET['rxcode'] == $row['offcode']) {
> $mqtt = new \PhpMqtt\Client\MQTTClient($server, $port, $clientId);
> $mqtt->connect();
> $mqtt->publish($row['mqtt_msg'] , $row['mqtt_status_off'],
> $row['mqtt_qos']);
> $mqtt->close();                                                      
> 
> $sql = "UPDATE $controltbl SET status = '0' WHERE offcode =
> ".$_GET['rxcode']."";
> $pdo->exec($sql);
> $sql = "INSERT INTO $recievedtbl (id, codecs, date, time) VALUES
> (NULL, '".$_GET['rxcode']."', '$date', '$time')";
> $pdo->exec($sql);
> print "2";
> }
> else { } 
> }
> }
> else {
> echo "Digga rxcode Variable setzten!";
> }
> 
> if ($anzahl_user == '0') {
> $sql = "INSERT INTO $unknowtbl (id, code, date, time) VALUES (NULL,
> '".$_GET['rxcode']."', '$date', '$time')";
> $pdo->exec($sql);
> print "3";
> }
> 
> require_once '../include/mysql_disconnect.include.php';
> 
> ?>
> 


>
> wenn ich
> http://192.168.5.90/smarthome/auswerten/rf_receive.php?rxcode=4457812
> anfüge wird dieser auch in die tbl geschrieben für empfangenem Code aber
> der Status wird nicht geändert. Mit Print sehe ich welchen Teil das Script
> welche abfolge durchlaufen ist On/Off.
>
> danke Lars

Habe die 0 nochmal gegen eine 0 ersetzt.
wenn ich in UFT-8 BOM speicher dann läuft es. PSPAD
mh was nun genau zum Erfolg führte keine Ahnung
DOS ANSI default (0) lief ja auch.

ok danke FORUM

 

gesamter Thread:

Ansicht:   
Auf unserer Web-Seite werden Cookies eingesetzt, um diverse Funktionalitäten zu gewährleisten. Hier erfährst du alles zum Datenschutz