I have a simple page which basically gets unique input text from user and queries the database to see if that any contact record belonging to that input. So far I know connection is established and it is trying to query the database. However, no record is retrieved. This is what the code looks like:
<form action="processAttendance.php" method="POST">
<div class="input">
<input type="text" class="button" id="inviteCode" name="inviteCode" placeholder="Enter invite code i.e. E2562SA">
<input type="submit" class="button" id="submit" value="Register">
</div>
</form>
<?php
include 'dbh.php';
$inviteCode = $_POST['inviteCode'];
echo $inviteCode;
$sql = "SELECT `FirstName`, `LastName`, `Confirmed`, `InviteCode`, `PlusOnes` FROM `Guest` WHERE 'InviteCode' = '$inviteCode'";
$result = $conn->query($sql);
$row = mysqli_fetch_assoc($result);
echo "my result" . $row."<br>";
echo "my result" . $row['classtype'];
The result printed back is as follows:
TEST
my resultArray
my result
Could anyone offer some insight as to why this could be the case?