I need to dynamically launch queries based on filters which change over time. Every time the filter is in the string variable $filter
.
Am I allowed to bind it after WHERE
like in the following code? It doesn't seem to work. The resulting query I expect is SELECT NAME FROM PERSONA WHERE GENDER='F'
$filter = "GENDER='F'";
$stmt = mysqli_stmt_init($connection);
mysqli_stmt_prepare($stmt, "SELECT NAME FROM PERSONA WHERE ?");
mysqli_stmt_bind_param($stmt, 's', $filter);