Guest User

Untitled

a guest
Jan 13th, 2019
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. I have two columns in a table and I want to update them both using php. little help please [closed]
  2. <?php
  3.  
  4.  
  5. $dbhostname = "localhost";
  6. $dbusername = "root";
  7. $dbpassword = "";
  8. $connection = mysql_connect($dbhostname, $dbusername, $dbpassword);
  9. $desc=$_POST['desc'];
  10. $code=$_POST['code'];
  11.  
  12.  
  13. mysql_select_db("bedanshare");
  14.  
  15. $up="UPDATE learning_material SET description='$desc', code='$code' WHERE code='$code'";
  16. mysql_query($up);
  17.  
  18. if($up){
  19. echo "<script type="text/javascript">
  20. alert("Update Success!")
  21. history.back()
  22. </script>";
  23. }
  24.  
  25. mysql_close($connection);
  26.  
  27. ?>
Add Comment
Please, Sign In to add comment