$wpdb in new OOP plugin
Hi I'm trying to write my first Wordpress plugin. I'm using classes to make it easier to maintain.
I'm wondering how I can use the WPDB class in my wordpress plugin.
$wpdb is a global variable, which is an instantiation of the class already set up to talk to the WordPress database.
you can use it in this manner -
global $wpdb; $result = $wpdb->get_row( "SELECT value FROM ".$wpdb->prefix."plg_table" ); echo $result;
For more info you can also check this link - Link To CODEX
If its your first i prefer to modify the existing one that i suggested few days back, check this link as it may help you showing plugin in frontend of website or in page