: This article mainly introduces the PDO of PHP. if you are interested in the PHP Tutorial, you can refer to it.
The PHP Data object (PDO) extension defines a lightweight consistent interface for PHP to access the database.
query($sql) or var_dump($pdo->errorInfo()); // var_dump($res);$mon = $res->fetch(PDO::FETCH_ASSOC); echo$mon['goods_price']; } catch (PDOException $e) { echo$e->getMessage(); } ?>
PDO operation transaction
// Start beginTransacition () // roll back rollback () // submit commit () // Determine whether the transaction is in inTransaction ()
Returns the ID of the last inserted row.
PDO: lastInsertID ()
<
Exec () execution
Compared with query (), exec () returns the number of affected rows.
$ SQL = "insert into table values ('$ val')"; if (false ===$ pdo-> exec ($ SQL) {echo 'execution failed ';}
'). AddClass ('pre-numbering '). hide (); $ (this ). addClass ('Has-numbering '). parent (). append ($ numbering); for (I = 1; I <= lines; I ++) {$ numbering. append ($ ('
'). Text (I) ;}; $ numbering. fadeIn (1700) ;}) ;}; script
The above describes the PDO of PHP, including some content, and hope to help those who are interested in PHP tutorials.