This snippet works to secure SQL query and pass queries to the database, I have had this snippet work before but somehow it does not now. This part of the whole code I believe is self-contained so the error shouldn’t be outside of this area, I hope you can spot the error that I could not on the (userquery)$stmt = $conn ->prepare($sql);
if($location == 'names') {
(userquery)$stmt = $conn->prepare($sql);
$stmt->bind_param('ss', $n1,$n2);
$result = $stmt->execute();
$query = $stmt->get_result();
real_escape_string() Function
$name = mysqli_real_escape_string($con, $_POST['name']);
include 'includes/userquery.php';
}