Db::startTrans(); //启动事务
try {
$newUserId = Db::name('user')->insertGetId($data); //新用户id
我怎么打印他要执行的sql语句是什么,我 想看看这条语句哪里错了。我看了一下日志文件,没有这个记录。
日志文件
[ info ] [ DB ] INIT mysql
[ sql ] [ DB ] CONNECT:[ UseTime:0.019327s ] mysql:host=localhost;port=3306;dbname=mmm;charset=utf8
[ sql ] [ SQL ] SHOW COLUMNS FROM `mmm_user` [ RunTime:0.017545s ]
[ sql ] [ SQL ] SELECT `user_name` FROM `mmm_user` WHERE `user_name` = 'www' LIMIT 1 [ RunTime:0.002523s ]
[ sql ] [ SQL ] SELECT `user_mobile` FROM `mmm_user` WHERE `user_mobile` = '17033334444' LIMIT 1 [ RunTime:0.002199s ]
[ sql ] [ SQL ] SHOW COLUMNS FROM `mmm_category` [ RunTime:0.016273s ]
[ sql ] [ SQL ] SELECT `category_user_id` FROM `mmm_category` WHERE `category_user_id` = 1000 LIMIT 1 [ RunTime:0.003109s ]
完全看不到这个insert语句是什么。
最佳答案
