I'm writing a plugin that needs to query the database, and I'm using the
$wpdb class of functions to do it.
I'm finding that if I don't declare
global $wpdb at the beginning of the function, I get an error:
Call to a member function query() on a non-object in ...
It works perfectly with the global declaration, but I was wondering whether declaring
$wpdb global was the best idea. The codex documentation seems just to assume that it should work straight off, which is why I'm concerned.