Advertisement
Guest User

Untitled

a guest
May 11th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. <?php
  2. session_start();
  3. $a=mysqli_connect("localhost","root","","members");
  4.  
  5. if(isset($_POST['update'])){
  6. $username=$_POST['username'];
  7. $password=$_POST['password'];
  8. $query1="select id from users where name='$username'";
  9.  
  10. $result=mysqli_query($a,$query1);
  11. $display=mysqli_fetch_assoc($result);
  12. $edit_record=display['id'];
  13.  
  14. $query="select * from users where id='$edit_record'";
  15. $run=mysqli_query($a,$query);
  16.  
  17. while ($row=mysqli_fetch_array($run))
  18. {
  19. $edit_id=$row['id'];
  20. $username= $row['name'];
  21. $password= $row['password'];
  22. }
  23.  
  24. $query2="update users set password='$password' where id='$edit_id'";
  25. if(mysqli_query($a,$query2))
  26. {
  27. }
  28. }
  29. ?>
  30.  
  31. <html>
  32. <head>
  33. <title>User's data</title>
  34. </head>
  35. <body>
  36.  
  37. <form action="Edit.php>" method="POST">
  38.  
  39.  
  40. <h1> updating records</h1>
  41.  
  42. <input type="text" name="username" id="username" value="Enter Username...">
  43.  
  44.  
  45. <input type="password" name="password" id="password" value="New Password"required>
  46.  
  47. <input type="submit" id="update" name="update" value="updatenow">
  48.  
  49. </form>
  50.  
  51.  
  52.  
  53. </body>
  54.  
  55. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement