public function createModelView($selectedModel) { $conn = RfidController::connect(); $sql = "SELECT items.rfid, items.items_id, items.serialNum, locations.location_id, locations.roomNumber, makes.makeName, models.model_name, models.model_id, users.userName, users.user_id FROM items join locations on items.location_id=locations.location_id join models on items.model_id=models.model_id join makes on models.make_id=makes.make_id join users on items.user_id=users.user_id where models.model_id = '{$selectedModel}'"; $result = $conn->query($sql); echo "<table>\r\n\t\t<tr>\r\n\t\t<th>RFID</th>\r\n\t\t<th>Serial Number</th>\r\n\t\t<th>Room Number</th>\r\n\t\t<th>Hand Receipt Holder</th>\t\r\n\t\t</tr>"; while ($row = mysqli_fetch_array($result)) { $selectedLocation = $row["location_id"]; $selectedItem = $row["items_id"]; $selectedUser = $row["user_id"]; echo "<tr>"; echo "<td><a href=itemLandingPage.php?fn={$selectedItem}>" . $row['rfid'] . "</td>"; echo "<td>" . $row['serialNum'] . "</td>"; echo "<td><a href=locationLandingPage.php?fn={$selectedLocation}>" . $row['roomNumber'] . "</td>"; echo "<td><a href=emailLandingPage.php?fn={$selectedUser}>" . $row['userName'] . "</td>"; echo "</tr>"; } echo "</table>"; if (!$result) { printf("Error: %s\n", mysqli_error($conn)); exit; } echo "<br/>"; $conn->close(); }
public function createLocationView($selectedLocation) { $conn = RfidController::connect(); $sql = "SELECT items.rfid, items.items_id, items.serialNum, makes.make_id, nomenclature.nomenclature_id, nomenclature.nomenclature_name, locations.roomNumber, makes.makeName, models.model_name, models.model_id, users.userName, users.user_id FROM items join locations on items.location_id=locations.location_id join models on items.model_id=models.model_id join makes on models.make_id=makes.make_id join users on items.user_id=users.user_id join nomenclature on models.nom_id = nomenclature.nomenclature_id where locations.location_id = '{$selectedLocation}' order by nomenclature_name, makeName, model_name, serialNum"; $result = $conn->query($sql); if (!$result) { printf("Error: %s\n", mysqli_error($conn)); exit; } echo "<table>\r\n\t\t<tr>\r\n\t\t<th>RFID</th>\r\n\t\t<th>Nomenclature</th>\r\n\t\t<th>Serial Number</th>\r\n\t\t<th>Make Name</th>\r\n\t\t<th>Model Name</th>\r\n\t\t<th>HR Holder</th>\t\t\r\n\t\t</tr>"; while ($row = mysqli_fetch_array($result)) { $selectedModel = $row["model_id"]; $selectedMake = $row["make_id"]; $selectedItem = $row["items_id"]; $selectedNom = $row["nomenclature_id"]; $selectedUser = $row["user_id"]; echo "<tr>"; echo "<td><a href=itemLandingPage.php?fn={$selectedItem}>" . $row['rfid'] . "</td>"; echo "<td><a href=nomLandingPage.php?fn={$selectedNom}>" . $row['nomenclature_name'] . "</td>"; echo "<td>" . $row['serialNum'] . "</td>"; echo "<td><a href=makeLandingPage.php?fn={$selectedMake}>" . $row['makeName'] . "</td>"; echo "<td><a href=modelToModel_id.php?fn={$selectedModel}>" . $row['model_name'] . "</td>"; echo "<td><a href=emailLandingPage.php?fn={$selectedUser}>" . $row['userName'] . "</td>"; echo "</tr>"; } echo "</table>"; echo "<br/>"; $conn->close(); }
public function createNomenclatureView($selectedNom) { $conn = RfidController::connect(); $sql = "SELECT makes.makeName, models.model_name, makes.make_id, models.model_id, count(items.rfid) as Items FROM models join makes on models.make_id=makes.make_id join items on models.model_id=items.model_id join nomenclature on models.nom_id=nomenclature.nomenclature_id where nomenclature.nomenclature_id = '{$selectedNom}' group by model_name order by model_name, makeName"; $result = mysqli_query($conn, $sql); if (!$result) { printf("Error: %s\n", mysqli_error($conn)); exit; } echo "<table>\r\n\t\t<tr>\r\n\t\t<th>Make Name</th>\r\n\t\t<th>Model Name</th>\r\n\t\t<th>Items</th>\r\n\t\t</tr>"; if ($result->num_rows > 0) { //output data of each row into the Array while ($row = $result->fetch_assoc()) { //$nameArray[]= (string)$row; $selectedModel = $row["model_id"]; $selectedMake = $row["make_id"]; echo "<tr>"; echo "<td><a href=makeLandingPage.php?fn={$selectedMake}>" . $row["makeName"] . "</a></td>"; echo "<td><a href=modelToModel_id.php?fn={$selectedModel}>" . $row['model_name'] . "</td>"; echo "<td>" . $row["Items"] . "</a></td>"; echo "</tr>"; } } echo "</table>"; mysqli_close($conn); }
public function createMakeView($selectedMake) { $conn = RfidController::connect(); $sql = "SELECT models.model_id, makes.makeName, models.model_name, makes.make_id, nomenclature.nomenclature_id, nomenclature.nomenclature_Name, users.user_id, count(models.model_name) as modName FROM models join makes on models.make_id=makes.make_id join nomenclature on models.nom_id=nomenclature.nomenclature_id join items on models.model_id=items.model_id join users on items.user_id=users.user_id where makes.make_id = '{$selectedMake}' and users.user_id != '44' group by models.model_name order by nomenclature.nomenclature_name"; $result = $conn->query($sql); if (!$result) { printf("Error: %s\n", mysqli_error($conn)); exit; } echo "<table>\r\n\t\t<tr>\r\n\t\t<th>Nomenclature</th>\r\n\t\t<th>Model Name</th>\r\n\t\t<th>Total</th>\r\n\t\t</tr>"; if ($result->num_rows > 0) { //output data of each row into the Array while ($row = $result->fetch_assoc()) { //$nameArray[]= (string)$row; $selectedMake = $row["make_id"]; $selectedModel = $row["model_id"]; $selectedNom = $row["nomenclature_id"]; echo "<tr>"; echo "<td><a href=nomLandingPage.php?fn={$selectedNom}>" . $row['nomenclature_Name'] . "</td>"; echo "<td><a href=modelToModel_id.php?fn={$selectedModel}>" . $row['model_name'] . "</td>"; echo "<td>" . $row["modName"] . "</a></td>"; echo "</tr>"; } echo "</table>"; } echo "<br/>"; $conn->close(); }
public function deleteUser($inUser) { //not functional until we add the delete fields to the tables $conn = RfidController::connect(); $sql = "UPDATE users SET delete_Boolean = '1' WHERE userName = '******'"; $result = $conn->query($sql); if (!$result) { die("Didn't Work " . mysqli_error($conn)); } else { echo "Success"; } $conn->close(); }
public function insertItem($rfid, $inModel, $location, $serialNum, $comments, $price, $hrHolder) { $conn = RfidController::connect(); //THIS WORKS $sql = "INSERT INTO items (rfid, model_id, location_id, serialNum, comments, price, user_id, delete_Boolean) VALUES ('{$rfid}', (SELECT model_id FROM models WHERE model_Name = '{$inModel}'), (SELECT location_id FROM locations WHERE roomNumber = '{$location}'), '{$serialNum}', '{$comments}', '{$price}', (SELECT user_id FROM users WHERE userName = '******'), '0')"; $result = $conn->query($sql); if (!$result) { printf("Error: %s\n", mysqli_error($conn)); exit; } $conn->close(); echo "Item added"; }
public function selectRFID($inrfid, $inSerial) { $conn = RfidController::connect(); $sql = "SELECT items.rfid, items.serialNum, locations.roomNumber, makes.makeName, models.model_name FROM items join locations on items.location_id=locations.location_id join models on items.model_id=models.model_id join makes on models.make_id=makes.make_id where rfid like '%{$inrfid}%' and serialNum like '%{$inSerial}%'"; //$sql = "SELECT * from 'makes'"; $result = $conn->query($sql); if ($result->num_rows > 0) { echo "<table><tr><th>RFID</th><th>Serial Number</th><th>Location</th><th>Make</th><th>Model</th></tr>"; // output data of each row while ($row = $result->fetch_assoc()) { echo "<tr><td>" . $row["rfid"] . "</td><td>" . $row["serialNum"] . "</td><td>" . $row["roomNumber"] . "</td><td>" . $row["makeName"] . "</td><td>" . $row["model_name"] . "</td></tr>"; } echo "</table>"; } else { echo "0 results"; } $conn->close(); }
<?php include 'handReceipt.php'; include 'RfidController.php'; //isset($_GET['fn']!=="John Doe" ) $name = $_GET['fn']; //Get the userName (email) based off of first and last name $split = explode(" ", $name); $fName = $split[0]; $lName = $split[1]; $conn = RfidController::connect(); $sName = "SELECT userName FROM users WHERE firstNAme= '{$fName}' and lastName= '{$lName}'"; $result = $conn->query($sName); if ($result->num_rows > 0) { while ($row = $result->fetch_assoc()) { $holder = $row["userName"]; } } echo $holder; $testObject = new handReceipt(); $testObject->createHR($holder);