【问题标题】:Update records dbal innodb silex更新记录 dbal innodb silex
【发布时间】:2014-08-28 07:28:49
【问题描述】:

我对 silex 和学说 dbal 有疑问

$update_sql = "UPDATE ca_mailing SET aktiviert = 2";
$count=  $app['db']->executeUpdate($update_sql, array());
echo "$count count";

-> 数据库中有 2 条记录,回显 2 -> 记录未更新。当数据库是 MyISAM 时,它可以工作。

这是架构:

CREATE TABLE `ca_mailing` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`email` varchar(255) NOT NULL,
`hash` varchar(255) NOT NULL,
`anrede` varchar(255) NOT NULL,
`aktiviert` int(1) NOT NULL,
`status` varchar(255) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `email` (`email`),
UNIQUE KEY `hash` (`hash`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1010 ;

【问题讨论】:

    标签: php mysql innodb silex dbal


    【解决方案1】:

    解决办法:

    我有:

     'driverOptions' => array(
                "SET NAMES 'UTF8'"
            )
    

    这会覆盖 PDO::ATTR_AUTOCOMMIT

    'driverOptions' => array(
                1002=>'SET NAMES utf8'
            )
    

    ->这是正确的设置方法

    【讨论】:

      猜你喜欢
      • 2015-10-19
      • 2017-06-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-02-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多