I am making a custom counter as a wordpress plugin and I hav a little problem with $wpdb This is the query that fails:
private function getMedlemmerfromDB(){
global $wpdb, $table_prefix;
$wpdb->plugin_medlemsteller = $table_prefix . "plugin_medlemsteller";
$fromdb=$wpdb->get_var("SELECT medlemmer FROM $wpdb->plugin_medlemsteller WHERE mID=(SELECT MAX(mID) FROM $wpdb->plugin_medlemsteller)");
return $fromdb;
}
i do not know what $table_prefix is set to. just hoping it's empty.
in my widget function:
public function widget( $args, $instance ) {
$medlemmer=getMedlemmerfromDB();
...
This fails, and the plugin (witch is still active) doesn't show.
The query works fine, but when I implement it in my plugin it causes the widget to crash.
Hope some one can help me out.
-Krister