35 lines
918 B
PHP
35 lines
918 B
PHP
<?php
|
|
/**
|
|
* Fetch both apron FPM values in a single database connection.
|
|
*
|
|
* Populates:
|
|
* $etdApronFPM - East Truck Dump Apron FPM (ID 0000524)
|
|
* $wtdApronFPM - West Truck Dump Apron FPM (ID 0000522)
|
|
*/
|
|
|
|
include __DIR__ . '/../dbinfo3.php';
|
|
|
|
$con = mysqli_connect($host, $username, $password, $database);
|
|
|
|
$etdApronFPM = 0;
|
|
$wtdApronFPM = 0;
|
|
|
|
if ($con) {
|
|
// Fetch both values in one query
|
|
$query = "SELECT ID, Value FROM items WHERE ID IN ('0000522', '0000524')";
|
|
$result = mysqli_query($con, $query);
|
|
|
|
if ($result) {
|
|
while ($row = mysqli_fetch_assoc($result)) {
|
|
$rawValue = (float) $row['Value'];
|
|
if ($row['ID'] === '0000524') {
|
|
$etdApronFPM = round($rawValue / 10, 2);
|
|
} elseif ($row['ID'] === '0000522') {
|
|
$wtdApronFPM = round($rawValue / 10, 2);
|
|
}
|
|
}
|
|
}
|
|
|
|
mysqli_close($con);
|
|
}
|