SHARE
TWEET

Untitled

a guest Nov 19th, 2019 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. # Access session.
  3. session_start() ;
  4.  
  5. if ( !isset( $_SESSION[ 'user_id' ] ) ) { require ( 'login_tools.php' ) ; load() ; }
  6.  
  7. # Connect to the database.
  8. require ('connect_db.php');
  9.  
  10. // Attempt delete query execution
  11. $stmt = $dbc->prepare("DELETE FROM users WHERE user_id = ? ");   // prepare query with placeholder (?) for id value
  12. $stmt->bind_param('i', $_SESSION['user_id']);                    // bind the id value to the placeholder
  13.  
  14. if ($stmt->execute()) {                                          // execute the query
  15.     echo "Records were deleted successfully.";
  16.     } else {
  17.     echo "ERROR: Not able to execute query " ;
  18.     }
  19. # Close database connection.
  20. mysqli_close( $dbc ) ;
  21. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top