在我的插件代码中,我从两个表中提取表id。id是从一个表中提取的,而不是从另一个表中提取的,在这两种情况下我都会出错。当我使用这些查询时,它们在mysql上工作。有什么想法吗?代码在下面,输出在下面。id是从wp\\U shclass表中提取的,而不是从wp\\U shinstructor表中提取的。有什么想法吗?我已经盯着这几天了,不知道出了什么问题。我正在使用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\');
下面是输出
你好,我是8
WordPress database error: []
select * from wp_shclass ORDER BY classid DESC LIMIT 1
您好,讲师这是
WordPress database error: []
select * from wp_shinstructor ORDER BY instructorid DESC LIMIT 1