Advertisement
Guest User

Untitled

a guest
Oct 31st, 2014
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. <?php
  2.  
  3. date_default_timezone_set('America/New_York');
  4.  
  5. $connection = mysql_connect("ocelot.aul.fiu.edu","DBname","password");
  6.  
  7. // Check connection
  8. if (!$connection)
  9. {
  10. echo "Connection failed: " . mysql_connect_error();
  11. }
  12. else
  13. {
  14. //select table
  15. mysql_select_db("DBname") or die(mysql_error());
  16. echo "Database Found! <br>";
  17.  
  18. $StudentID = $_POST["StudentID"];
  19. $firstName = $_POST["firstName"];
  20. $lastName = $_POST["lastName"];
  21.  
  22. $query = "UPDATE DBname.students
  23. SET firstName = '$firstName',
  24. lastName = '$lastName'
  25. WHERE StudentID = '$StudentID'";
  26.  
  27. $res = mysql_query($query);
  28.  
  29. if ($res)
  30. {
  31. echo "<p>Record Updated<p>";
  32. }
  33. else
  34. {
  35. echo "Problem updating record. MySQL Error: " . mysql_error();
  36. }
  37. }
  38.  
  39. mysql_close($connection);
  40. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement