Are you sure the query is running? What's the error you're getting from MySQL? Have you tried echoing out the query as a debugging measure to see it's what you expect?
I don't see where you set $data->account_id, $data->accat1, or $accat1. It looks like there's an input form that sets $_GET['accat1'] or $_POST['accat1'].
Problems like these are much more likely to be answered when you can give as much information as possible, including any warning/error messages, what debugging steps have you already tried, etc.