pdophp
$db = new pdo('mysql:host=localhost;dbname=db;charset=utf8', 'root', 'root');
$db->setattribute(pdo::attr_emulate_prepares, false);
$db->query('set names utf8');
$sth = $db->prepare(insert into table (id, name) values (null, ?));
$sth->execute(array('name'));
使用上述代码可以成功插入数据,但是运行后每次插入的数据都是两条重复的,请求各位达人帮解小弟疑惑 - -