Your problem is this line:

$q = "SELECT 'professional','private', 'contact' FROM users WHERE 'sub_domain' = '$prac_dir';

you can not use quotes to define each field name. It needs to be this:...