Guest User

Untitled

a guest
Sep 12th, 2018
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. <?php
  2. if(isset($_POST['update'])) {
  3.  
  4. $dsn = 'mysql:host=localhost;dbname=ops';
  5. $username = 'ttt';
  6. $password = 'abc123';
  7.  
  8. // Connect To MySQL Database
  9. $con = new PDO($dsn,$username,$password);
  10.  
  11. if(! $con ) {
  12. die('Could not connect: ' . mysql_error());
  13. }
  14.  
  15.  
  16. //Update Data
  17.  
  18. $cotwid= $_POST['cotwid'];
  19. $empid = $_POST['empid'];
  20. $evaldate = $_POST['evaldate'];
  21. $status = $_POST['status'];
  22. $marksgain = $_POST['marksgain'];
  23. $arreason= $_POST['arreason'];
  24.  
  25.  
  26. $sql = "UPDATE cotw SET status = $status, evaldate=$evaldate, marksgain=$marksgain, arreason=$arreason, evaluatedby=$userid WHERE cotwid= $cotwid" ;
  27.  
  28. mysql_select_db('ops');
  29. $retval = mysql_query( $sql, $con );
  30.  
  31. if(! $retval ) {
  32. die('Could not update data: ' . mysql_error());
  33. }
  34. echo "Updated data successfully";
  35. echo "<script>window.open('pcotw.php','_self')</script>";
  36.  
  37. mysql_close($conn);
  38. }
  39. else
  40. {
  41. echo "Testing update";
  42. }
  43. ?>
Add Comment
Please, Sign In to add comment