Advertisement
wipeautcrafter

PHP url shortener

Dec 14th, 2016
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.55 KB | None | 0 0
  1. <?php
  2. $servername = "localhost";
  3. $username = "niets";
  4. $password = "ook niets";
  5. $dbname = "nogeens niets";
  6.  
  7. // Create connection
  8. $conn = new mysqli($servername, $username, $password, $dbname);
  9. // Check connection
  10. if ($conn->connect_error) {
  11.     die("Connection failed: " . $conn->connect_error);
  12. }
  13.  
  14. $stmt = $dbh->prepare("INSERT INTO URLshort (ID, URL) VALUES (:ID, :URL)");
  15. $stmt->bindParam(':ID', $ID);
  16. $stmt->bindParam(':URL', $URL);
  17.  
  18. // insert one row
  19. $ID = 'rickroll';
  20. $URL = 'neva gonna give u up';
  21. $stmt->execute();
  22.  
  23.  
  24. $conn->close();
  25. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement