Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- global $DB_con;
- error_reporting( ~E_NOTICE );
- require_once 'dbconfig.php';
- if(isset($_GET['edit_id']) && !empty($_GET['edit_id']))
- {
- $id = $_GET['edit_id'];
- $custDb=$oDb->dbConnection();
- $custDb->conn->prepare('SELECT userName, userEmail, phone FROM tbl_users WHERE userID =:uid');
- $stmt_edit->execute(array(':uid'=>$id));
- $edit_row = $stmt_edit->fetch(PDO::FETCH_ASSOC);
- extract($edit_row);
- }
- else
- {
- header("Location: home.php");
- }
- if(isset($_POST['btn_save_updates']))
- {
- $uname = trim($_POST['txtuname']);
- $email = trim($_POST['txtemail']);
- $phone = trim($_POST['phone']);
- if(!isset($errMSG))
- {
- $stmt = $DB_con->prepare('UPDATE tbl_users SET userName=:uname, userEmail=:email, phone=:phone WHERE userID=:uid');
- $stmt->bindparam(":user_name",$uname);
- $stmt->bindparam(":user_email",$email);
- $stmt->bindparam(":phone",$phone);
- $stmt->bindParam(':uid',$id);
- if($stmt->execute()){
- ?>
- <script>
- alert('Successfully Updated ...');
- window.location.href='home.php';
- </script>
- <?php
- }
- else{
- $errMSG = "Sorry Data Could Not Updated !";
- }
- }
- }
- ?>
Add Comment
Please, Sign In to add comment