Okay, I took out all the functions to eliminate out of scope variables and am now getting an error on the last line. " Call to undefined method mysqli_result::fetch_all()"
$conn = new mysqli(DBHOST, DBUSER, DBPASS, DBNAME);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "SELECT * FROM users";
$result = $conn->query($sql);
$rows = $result->fetch_all(MYSQLI_ASSOC);