Guest User

Untitled

a guest
Aug 23rd, 2018
323
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. <?php
  2. $dsn = 'mysql:host=localhost;dbname=dbsample';
  3. $username = 'root';
  4. $password = '';
  5. $options = [];
  6. try {
  7. $connection = new PDO($dsn, $username, $password, $options);
  8. }
  9. catch(PDOException $e) {
  10.  
  11. $id = $_GET['id'];
  12. $sql = 'INSERT INTO table2 SELECT * FROM table1 WHERE id=:id';
  13. $sql. = 'DELETE FROM table1 WHERE id=:id';
  14. $statement = $connection->prepare($sql);
  15. if ($statement->execute([':id' => $id])) {
  16. header("Location:.");
  17. }
Add Comment
Please, Sign In to add comment