Well, I have this function in a custom script for SMF:
$query = \"SELECT id_member, real_name, id_group FROM smf_members WHERE id_group > 0 AND id_group != 9
Your function doesn't do anything: It assigns a value to a local variable, and then does nothing with the value and the variable. It should either return it (the value) or execute the query.
Also note that doing string concatenation to put the variable in the query is creating a security hole: http://bobby-tables.com/
You should consider using mysqli and parametrized queries as suggested here: http://bobby-tables.com/php.html
At the very least, consider quoting the values you include in the query with the functions provided by PHP to do so. All values. But parametrized queries are better and easier.