Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- # Access session.
- session_start() ;
- if ( !isset( $_SESSION[ 'user_id' ] ) ) { require ( 'login_tools.php' ) ; load() ; }
- # Connect to the database.
- require ('connect_db.php');
- // Attempt delete query execution
- $stmt = $dbc->prepare("DELETE FROM users WHERE user_id = ? "); // prepare query with placeholder (?) for id value
- $stmt->bind_param('i', $_SESSION['user_id']); // bind the id value to the placeholder
- if ($stmt->execute()) { // execute the query
- echo "Records were deleted successfully.";
- } else {
- echo "ERROR: Not able to execute query " ;
- }
- # Close database connection.
- mysqli_close( $dbc ) ;
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement