I have a simple PostgreSql query that looks like:
$params = array();
if ($audienceId === x) {
// all teachers
$pullRecipients = $db -> prepare(
"SELECT email FROM app.employees WHERE emp_cat_id = 1 AND active is true");
}
$pullRecipients -> execute($params);
I'm running the queries based on a drop down select, so that if for example the user selects TEACHERS
, the above query is run. How can I select for instance the emp_cat_id
or even the category name TEACHERS
without hard coding them in the query?
change statement to something like
and make sure your
$params
is equal to something likearray($POST["drop-down_value])
and if you want to allow text value - use join, something like: