Advertisement
Guest User

implement userspice

a guest
Apr 1st, 2017
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.71 KB | None | 0 0
  1. $servername = "";
  2. $username = "";
  3. $password = "";
  4. $dbname = "";
  5.  
  6. $conn = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password);
  7.        
  8. $query = $conn->prepare("INSERT INTO foo (user_id,aaa,bbb,ccc,ddd,eee,fff) VALUES (:user_id, :aaa, :bbb, :ccc, :ddd, :eee, :fff)");
  9.  
  10. $query->bindParam(':user_id', $user_id);
  11. $query->bindParam(':aaa', $aaa);
  12. $query->bindParam(':bbb', $bbb);
  13. $query->bindParam(':ccc', $ccc);
  14. $query->bindParam(':ddd', $ddd);
  15. $query->bindParam(':eee', $eee);
  16. $query->bindParam(':fff', $fff);
  17.  
  18. $user_id  = 2;
  19. $aaa      = $_POST["aaa"];
  20. $bbb      = $_POST["bbb"];
  21. $ccc      = $_POST["ccc"];
  22. $ddd      = $_POST["ddd"];
  23. $eee      = $_POST["eee"];
  24. $fff      = 1;
  25.  
  26. $query->execute();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement