Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $dsn = 'mysql:host=localhost;dbname=dbsample';
- $username = 'root';
- $password = '';
- $options = [];
- try {
- $connection = new PDO($dsn, $username, $password, $options);
- }
- catch(PDOException $e) {
- $id = $_GET['id'];
- $sql = 'INSERT INTO table2 SELECT * FROM table1 WHERE id=:id';
- $sql. = 'DELETE FROM table1 WHERE id=:id';
- $statement = $connection->prepare($sql);
- if ($statement->execute([':id' => $id])) {
- header("Location:.");
- }
Add Comment
Please, Sign In to add comment