Advertisement
Guest User

Untitled

a guest
May 30th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. <?php
  2. $servername = "localhost";
  3. $username = "matias";
  4. $password = "L9PbZwGw6Zfw9cwG";
  5. $dbname = "matias";
  6.  
  7. $facebook = $_GET['facebookUpdate'];
  8. $linkedin = $_GET['linkedinUpdate'];
  9. $google = $_GET['googleUpdate'];
  10. $youtube = $_GET['youtubeUpdate'];
  11. $pinterest = $_GET['pinterestUpdate'];
  12. $instagram = $_GET['instagramUpdate'];
  13. $twitter = $_GET['twitterUpdate'];
  14.  
  15. // Create connection
  16. $conn = new mysqli($servername, $username, $password, $dbname);
  17. // Check connection
  18. if ($conn->connect_error) {
  19. die("Connection failed: " . $conn->connect_error);
  20. }
  21.  
  22. $sql = "UPDATE contacts SET facebook = COALESCE('$facebook', facebook), linkedin = COALESCE('$linkedin', linkedin), google = COALESCE('$google', google), youtube = COALESCE('$youtube',youtube), pinterest = COALESCE('$pinterest',pinterest), instagram = COALESCE('$instagram', instagram), twitter = COALESCE('$twitter', twitter)";
  23.  
  24. if ($conn->query($sql) === TRUE) {
  25. echo "Record updated successfully";
  26. } else {
  27. echo "Error updating record: " . $conn->error;
  28. }
  29.  
  30. $conn->close();
  31. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement