MySQL 5.6 vs 5.7 + PHP autocommit(false)

时间:2017-02-21 23:05:39

标签: php mysql prepared-statement

我最近从MySQL 5.6升级到5.7,出于某种原因,使用$ db-> autocommit(FALSE);在5.7中只是没有插入db,但当我切换回5.6:一切都很好。有什么想法吗?

$db->autocommit(FALSE);

$query = "INSERT INTO test (one, two) VALUES (?, ?) ";
        $statement = $db->prepare($query);
        $statement->bind_param('is', $one, $two);
        $statement->execute();

$query = "INSERT INTO test2 (one2, two2) VALUES (?, ?) ";
        $statement = $db->prepare($query);
        $statement->bind_param('is', $one2, $two2);
        $statement->execute();

$db->commit();

连接字符串

ini_set(' error_reporting',E_ALL); ini_set(' display_errors',' 1'); error_reporting(E_ALL | E_STRICT);

$db = mysqli_init();
mysqli_options ($db, MYSQLI_OPT_SSL_VERIFY_SERVER_CERT, true);

$db->ssl_set('/tmp/client-key.pem', '/tmp/client-cert.pem', '/tmp/server-ca.pem', NULL, NULL);

$link = mysqli_real_connect ($db, '111.111.111.111', 'test', 'test', 'test', 3306, NULL, MYSQLI_CLIENT_SSL);
//$db->set_charset('utf8');

0 个答案:

没有答案