pdo_mysql 值自增写法
黄舟
黄舟 2017-04-17 15:30:59
0
2
650

以前用mysql_query的时候,为了实现数据库计数,是使用

mysql_query("update table set field=field+1 where ....");

这种方式,现在整体换成pdo_mysql的话,

("update table set field=? where ....")

然后?处bind field+1肯定是不行了...

怎么写自增效率较高呢?请教下各位,感谢

黄舟
黄舟

人生最曼妙的风景,竟是内心的淡定与从容!

reply all(2)
伊谢尔伦

Ah, isn’t there a query method?

$pdo = new \PDO($dsn, $user, $password);
$pdo->query("update table set field=field+1 where ....");
小葫芦

It’s okay if you don’t need parameter substitution in this place... just write field=field+1

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!