I run into this error occasionally with the fetch_array() function, but only at certian hook locations which can be different on other sites, and I have found that making $db global is the cure. Why this needs to be done for some sites and not others I have no clue, but I think I will start including that statement in every plugin that uses the fetch_array() function from now on just to make sure everyone is covered.