Closed gamefans123 closed 3 years ago
Medoo 版本 1.6.1
$db = new Medoo([ 'database_type' => 'mysql', 'database_name' => 'testdb', 'server' => 'localhost', 'username' => 'root', 'password' => '123456', 'charset' => 'utf8mb4', 'port' => 3306, 'option' => [ PDO::ATTR_CASE => PDO::CASE_NATURAL, ] ]);
$pdo = new PDO("mysql:host=localhost;dbname=testdb;port=3306","root","123456");
$pdo -> query("set names utf8mb4");
MySQL5.6 表名:test a1(主键), a2(varchar200 不允许空), a3(varchar200 不允许空), a4(int)
$db->insert("test",["a1" => "35"]); 使用Medoo仍能正常插入(出错),使用下面则不能插入成功(正确)
$sql=$pdo->prepare("insert into test (a4) values (?)");
$sql->execute(array(12));
或
$pdo->exec("INSERT INTO
test
(a1
) VALUES ('36')");