I didn't say "query", I said "$query" - as in the variable you're passing in to $dbh->prepare().
The query you posted, "SELECT user_id, username FROM users WHERE purch_perm_id != 1 AND deleted != 1 ORDER BY username" has no placeholders, so you shouldn't be binding anything.
Then the next place to look is where you're doing your binding.
@dsetcols=[];
I don't think this is doing what you think it's doing. It might be, I'm not entirely sure. This is setting @dsetcols to be an array with one element: an arrayref. You probably want:
@dsetcols=();
which sets @dsetcols to an empty array. Next you do:
@fieldnames = split(/,/, $fnames);
So, when your code fails, what is $fnames? Print that out in your error message, too. I would expect that your example query doesn't have a blank $fnames, even though it should. | [reply] [d/l] [select] |