Advertisement
Guest User

Untitled

a guest
Aug 4th, 2017
473
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. <?php
  2. $servername = "mysql.hostinger.co.uk";
  3. $database = "u266072517_name";
  4. $username = "u266072517_user";
  5. $password = "buystuffpwd";
  6.  
  7. // Create connection
  8.  
  9. $conn = mysqli_connect($servername, $username, $password, $database);
  10.  
  11. // Check connection
  12.  
  13. if (!$conn) {
  14. die("Connection failed: " . mysqli_connect_error());
  15. }
  16.  
  17. echo "Connected successfully";
  18.  
  19. $sql = "INSERT INTO Students (name, lastname, email) VALUES ('Thom', 'Vial', 'thom.v@some.com')";
  20. if (mysqli_query($conn, $sql)) {
  21. echo "New record created successfully";
  22. } else {
  23. echo "Error: " . $sql . "<br>" . mysqli_error($conn);
  24. }
  25. mysqli_close($conn);
  26.  
  27. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement