在进行wordpress插件开发时,我正在创建一个带有以下字符串的表(安装插件时):
$sql = "CREATE TABLE (query skipped)..."; /*someting*/
例如:我有这个
register_activation_hook( __FILE__, \'my_plugin_install\' );
function my_plugin_install(){
$sql = "CREATE TABLE (query skipped)..."; /*someting*/
echo $sql;
}
问题是这个查询有一些错误,我想看看使用php的$sql的输出。
但当安装插件时,上面的代码不会响应任何内容。有办法看到输出吗?
Details:
function my_plugin_install(){
global $wpdb, $current_user;;
//getting the musician/user rating keys
global $k11, $k12, $k13, $k14, $k21, $k22, $k23, $k24;
$fabprofile_table_name=$wpdb->prefix."fabulous_profile";
$fabulous_profile_version = "2.0";
//mid= music user id
//uid = general user id
//creating the ratings table
$sql = "CREATE TABLE $fabprofile_table_name (
mid tinyint(9) NOT NULL,
uid tinyint(9) NOT NULL,
$k11 tinyint(1) NOT NULL, $k12 tinyint(1) NOT NULL,$k13 tinyint(1) NOT NULL, $k14 tinyint(1) NOT NULL,
$k21 tinyint(1) NOT NULL, $k22 tinyint(1) NOT NULL, $k23 tinyint(1) NOT NULL, $k24 tinyint(1) NOT NULL
);";
require_once( ABSPATH . \'wp-admin/includes/upgrade.php\' );
dbDelta( $sql );
$wpdb->show_errors();
echo $sql;
}