由于项目需要,刚开始用mysql,在创建事件的时候想使用动态表名,结果总是报错。代码如下 create EVENT createMtpulseTable ON SCHEDULE AT DATE_FORMAT(CURRENT_DATE(),'%Y-%m-%d 14:07:00') DO create table CONCAT('mtpulse',DATE_FORMAT(CURRENT_DATE(),'%Y%m'))(id INT not NULL PRIMARY KEY auto_increment)
最新回答
——_戏子℡
2024-10-31 09:04:29
$creat_table = $prefix."account_log_".trim($_POST['tab_head']); $sql = " CREATE TABLE IF NOT EXISTS `" .$prefix."account_log_".trim($_POST['tab_head'])."` ( `log_id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, `user_id` mediumint(8) unsigned NOT NULL, `admindo` varchar(50) NOT NULL, `admin_id` mediumint(8) unsigned NOT NULL, `user_money` decimal(10,2) NOT NULL, `frozen_money` decimal(10,2) NOT NULL, `rank_points` mediumint(9) NOT NULL, `pay_points` mediumint(9) NOT NULL, `change_time` int(10) unsigned NOT NULL, `change_desc` varchar(100) NOT NULL, `change_type` tinyint(3) unsigned NOT NULL, PRIMARY KEY (`log_id`), KEY `user_id` (`user_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; "; $db->query($sql); 我用的是脚本来创建的 mysql的内部编程应该也是可以的