12345678910111213 |
- <?php
- try {
- $dbh = new PDO('mysql:host=localhost;dbname=test2', "test2", "TeSt2");
- $sth = $dbh->prepare('INSERT INTO person SET name = :name, surname = :surname, father_name = :father_name');
- $sth->execute(array( ":name" => "Donald", ":surname" => "Trump", ":father_name" => "Moishovich"));
- foreach($dbh->query("SELECT * FROM person") as $row) {
- print_r($row);
- }
- $dbh = null;
- } catch (PDOException $e) {
- print "Error!: " . $e->getMessage() . "<br/>";
- die();
- }
|