以前用mysql_query的时候,为了实现数据库计数,是使用
mysql_query("update table set field=field+1 where ....");
这种方式,现在整体换成pdo_mysql的话,
("update table set field=? where ....")
然后?处bind field+1肯定是不行了...
怎么写自增效率较高呢?请教下各位,感谢
人生最曼妙的风景,竟是内心的淡定与从容!
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
Ah, isn’t there a query method?
It’s okay if you don’t need parameter substitution in this place... just write field=field+1