Guest User

editttttt

a guest
Oct 17th, 2016
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. <?php
  2. global $DB_con;
  3. error_reporting( ~E_NOTICE );
  4. require_once 'dbconfig.php';
  5.  
  6. if(isset($_GET['edit_id']) && !empty($_GET['edit_id']))
  7. {
  8. $id = $_GET['edit_id'];
  9. $custDb=$oDb->dbConnection();
  10. $custDb->conn->prepare('SELECT userName, userEmail, phone FROM tbl_users WHERE userID =:uid');
  11. $stmt_edit->execute(array(':uid'=>$id));
  12. $edit_row = $stmt_edit->fetch(PDO::FETCH_ASSOC);
  13. extract($edit_row);
  14. }
  15. else
  16. {
  17. header("Location: home.php");
  18. }
  19.  
  20.  
  21. if(isset($_POST['btn_save_updates']))
  22. {
  23.  
  24. $uname = trim($_POST['txtuname']);
  25. $email = trim($_POST['txtemail']);
  26. $phone = trim($_POST['phone']);
  27.  
  28. if(!isset($errMSG))
  29. {
  30. $stmt = $DB_con->prepare('UPDATE tbl_users SET userName=:uname, userEmail=:email, phone=:phone WHERE userID=:uid');
  31. $stmt->bindparam(":user_name",$uname);
  32. $stmt->bindparam(":user_email",$email);
  33. $stmt->bindparam(":phone",$phone);
  34. $stmt->bindParam(':uid',$id);
  35.  
  36.  
  37. if($stmt->execute()){
  38. ?>
  39. <script>
  40. alert('Successfully Updated ...');
  41. window.location.href='home.php';
  42. </script>
  43. <?php
  44. }
  45. else{
  46. $errMSG = "Sorry Data Could Not Updated !";
  47. }
  48. }
  49. }
  50. ?>
Add Comment
Please, Sign In to add comment