tamaro_skaljic

delete_account.php

Jun 27th, 2021 (edited)
629
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.45 KB | None | 0 0
  1. <?php
  2. // Delete the account associated with the id of the logged in user and all messages the user has sent
  3. $query = "DELETE FROM public.user WHERE user_id = :user_id";
  4. $query_params = array(':user_id' => $_SESSION['user_id']);
  5. try{
  6.     $stmt = $pdo->prepare($query);
  7.     $result = $stmt->execute($query_params);
  8. }
  9. catch(PDOException $ex){
  10.     // If something went wront, fail early
  11.     echo '<span style="color: red">ERROR! Code: 005</span>';
  12.     exit;
  13. }
  14. ?>
Add Comment
Please, Sign In to add comment