<?php
$servername = "localhost";
$username = "schoolro_maker";
$password = "JesusChristisLord";
$dbname = "aurarich_erp";
$num = 1;
$servername = "localhost";
$username = "schoolro_maker";
$password = "JesusChristisLord";
$dbname = "aurarich_attendance-business$num";
$conn = mysqli_connect($servername, $username, $password, $dbname);


// $query = mysqli_query($conn, "SELECT * FROM staff");
// while ($spec = mysqli_fetch_assoc($query)) {
//     // mjkband01.oss-cn-shenzhen.aliyuncs.com/images/c6535f83-7733-4fae-a8fa-682125bb2d62.png?x-oss-process=image/resize,m_lfit,h_500,w_500
//     $sql = ("INSERT INTO attendance_device_users (macId, name, departmentId, departmentName, post, picturePath, jobNumber, sex, tenantId, idCard, updateTime) VALUES ('97e3997468bc', '" . $spec["title"] . " " . $spec["first_name"] . " " . $spec["last_name"] . "', '2', 'Staff', '" . $spec["role"] . "', 'mjkband01.oss-cn-shenzhen.aliyuncs.com/images/c6535f83-7733-4fae-a8fa-682125bb2d62.png?x-oss-process=image/resize,m_lfit,h_500,w_500', '" . $spec["unique_user_id"] . "','" . $spec["gender"] . "','" . $spec["id"] . "','" . $spec["unique_user_id"] . "','" . date('Y-m-d H:i:s') . "')");
//     if (mysqli_query($conn, $sql)) {
//     } else {
//         echo "Error: " . mysqli_error($conn);
//     }
// }

// $sql = ("UPDATE attendance_device_list SET updated_on = '" . date('Y-m-d H:i:s') . "' WHERE businessid = '201934050719184' AND macId = '97e3997468bc'");
// if (mysqli_query($business_conn, $sql)) {
// } else {
// }
