In my plugin code, I am pulling the table id from two tables. The id is being pulled from one table but not from the other and I get errors in both instances. The queries work on mysql when I use them. any thoughts? code is below and output below that. The id gets pulled from the wp_shclass table but not the wp_shinstructor table. Any thoughts I have been staring at this for a few days and am not sure what's wrong. I am using wp 3.3.1
function shmain_admin(){
if (!current_user_can('manage_options')) {
wp_die( __('You do not have sufficient permissions to access this page.') );
}
echo "Hello class";
global $wpdb;
$shrow = $wpdb->get_row("select * from wp_shclass ORDER BY classid DESC LIMIT 1", ARRAY_A);
$shclassid = $shrow['classid'];
echo "<br> this is " . $shclassid;
$wpdb->show_errors();
$wpdb->print_error();
echo "<br> Hello instructor";
$shrow = $wpdb->get_row("select * from wp_shinstructor ORDER BY instructorid DESC LIMIT 1", ARRAY_A);
$shinstructorid = $shrow['instructorid'];
echo "<br> this is " . $shinstructorid;
$wpdb->print_error();
}
function shmain_admin_action(){
add_menu_page('sh main', 'main', 'manage_options','shmain', 'shmain_admin');
}
add_action('admin_menu','shmain_admin_action');
and here is the output below
Hello class this is 8
WordPress database error: [] select * from wp_shclass ORDER BY classid DESC LIMIT 1
Hello instructor this is
WordPress database error: [] select * from wp_shinstructor ORDER BY instructorid DESC LIMIT 1