This may seem like a very dumb question, but I don't know if it's possible. I'm trying to write a function as follows:
function checkDuplicates($input) {
$result = pg_query('SELECT username FROM accounts WHERE LOWER(username)=\''.strtolower(pg_escape_string($input)).'\'') or exit(pg_last_error());
}
and I want to replace "username" with the name of the variable being passed in. For example, if I called checkDuplicates($email)
, I want essentially the following function to be called:
function checkDuplicates($email) {
$result = pg_query('SELECT email FROM accounts WHERE LOWER(email)=\''.strtolower(pg_escape_string($email)).'\'') or exit(pg_last_error());
}
Is there any way to do this?