データがすでにarduinoから受信されていることをphpページからアラート
私は現在、arduinounoとイーサネットシールドを使用した出席システムに関するプロジェクトを行っています。今のところ、arduinoから取得したIDをデータベースに正常に保存しました。私の問題は、arduinoからデータを受信するたびに、データが受信されてデータベースに保存されたことを示すアラートまたはポップアップメッセージを作成する方法です。
ありがとうございます。
以下は私のarduinoコードです:
phpコード
if (client.connect(myServer, 80)) {
Serial.println("Connecting to Database server");
// send the HTTP PUT request:
client.print("GET /school/inc/jaripelajar.php?P_ID=");
client.print(P_ID);
client.println(" HTTP/1.1");
client.println("Host: 192.168.137.1");
client.println("User-Agent: arduino-ethernet");
client.println("Connection: close");
client.println();
}
// GET request
if (isset($_GET['P_ID'])){
$data1 = $_GET['P_ID'];
}
else{
//echo "Data not received";
}
// Initialize connection to MySQL database
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "school";
// Create connection
$conn = mysqli_connect($servername, $username, $password, $dbname);
// Check connection
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
//echo "Connected successfully <br>";
//Insert into database
$data1_sql = "INSERT INTO test (P_ID) VALUES ($data1);";
$data1_query = mysqli_query($conn, $data1_sql);
同様の質問
私たちのウェブサイトで同様の質問で答えを見つけてください。