Get PHP Fatal error on globalized $wpdb: Call to a member function insert() on a non-object- I have no clue. What to do?
You did everything right with the globalize, the error message is just telling you that you called a function on $wpdb which does not exists. Just check prior you do that $wpdb contains the object you’re intersted in: if (is_object($wpdb) && is_a($wpdb, ‘wpdb’)) { $result = $wpdb->insert( ‘wp_weights’, array( ‘user_id’ => $userid, ‘current_weight’ => $weight … Read more