This post explains the $wpdb class and how to use it to connect to and interact with the WordPress database.