Advertisement
Guest User

Untitled

a guest
Nov 14th, 2016
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. <?php
  2. $db_host = "localhost";
  3. $db_name = "webdb";
  4. $db_user = "user";
  5. $db_pass = "password";
  6.  
  7. try{
  8. $db_con = new PDO("mysql:host={$db_host};dbname= {$db_name}",$db_user,$db_pass);
  9. $db_con->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  10. }
  11. catch(PDOException $e){
  12. echo $e->getMessage();
  13. }
  14.  
  15. $id = $_REQUEST['del_id'];
  16.  
  17. /*$_REQUEST['del_id'] is this string: "[abcd]" square brackets included*/
  18.  
  19. $stmt=$db_con->prepare("DELETE FROM profiles WHERE context=:id");
  20. $stmt->execute(array(':id'=>$id));
  21.  
  22. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement