/*int(5)与 int(10) 与 int(11) 的区别*/ //首先创建 三个表 分别是 in5,in10,in11 都只有一个字段 $sql="create table in5( time INT(5) ) ENGINE=MyISAM DEFAULT CHARSET=utf8"; mysqli_real_query($con,$sql); $sql="create table in10( time INT(10) ) ENGINE=MyISAM DEFAULT CHARSET=utf8"; mysqli_real_query($con,$sql); $sql="create table in11( time INT(11) ) ENGINE=MyISAM DEFAULT CHARSET=utf8"; mysqli_real_query($con,$sql); //每个表插入十万数据 mysqli_autocommit($con,FALSE); //关闭自动提交 for ($i=1; $i<=100000; $i++){ $t=time(); mysqli_real_query($con,"insert into in5(time)values({$t})"); mysqli_real_query($con,"insert into in10(time)values({$t})"); mysqli_real_query($con,"insert into in11(time)values({$t})"); } mysqli_commit($con); // 提交事务 echo "插入完毕!";
结论: 对占用空间的大小 毫无区别 只是显示形式的问题