PHP PDO database class update operation

WBOY
Release: 2016-07-25 08:54:34
Original
2242 people have browsed it
  1. //Data update

  2. $sql = "UPDATE `test` SET `name`=:name WHERE `id`=:id";
  3. $stmt = $pdo ->prepare($sql);
  4. $stmt->execute(array(':name' => 'Liu Ba', ':id' => 8));

  5. < p>echo $stmt->rowCount();

Copy code

Also: PDOStatement::rowCount() Returns the number of rows affected by the last DELETE, INSERT, or UPDATE statement executed by the corresponding PDOStatement object.



source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template