<?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);
die("Connection failed: " . $conn->connect_error); } $sql = "SELECT users.userName, nomenclature.nomenclature_Name, locations.roomNumber, makes.makeName, models.model_Name, items.rfid, items.serialNum FROM items join locations on items.location_id=locations.location_id join models on items.model_id=models.model_id join nomenclature on nomenclature.nomenclature_id=models.nom_id join makes on models.make_id=makes.make_id join users on users.user_id=items.user_id WHERE userName like '%{$selectedName}%' "; // WHERE user.userName=$selectedName $result = $conn->query($sql); if (!$result) { die("Didn't Work " . mysqli_error($conn)); } mysqli_select_db($conn, "rfid_database"); // output data of each row echo "<table>\r\n\t\t<tr>\r\n\t\t<th>Nomenclature</th>\r\n\t\t<th>Count</th>\r\n\t\t<th>Location</th>\r\n\t\t<th>Make</th>\r\n\t\t<th>Model</th>\r\n\t\t<th>Serial Number</th>\r\n\t\t<th>RFID</th>\t\t\r\n\t\t</tr>"; while ($row = mysqli_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row['nomenclature_Name'] . "</td>"; echo "<td> 1 </td>"; echo "<td>" . $row['roomNumber'] . "</td>"; echo "<td>" . $row['makeName'] . "</td>"; echo "<td>" . $row['model_Name'] . "</td>"; echo "<td>" . $row['serialNum'] . "</td>"; echo "<td>" . $row['rfid'] . "</td>"; echo "</tr>"; } echo "</table>"; mysqli_close($conn); } } $testObject = new handReceipt(); $testObject->createHR('*****@*****.**'); ?> </body> </html>