Advertisement
Guest User

insertarcoche.php

a guest
Dec 12th, 2016
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. <?php
  2. if ((isset($_POST["marca"]))&&(isset($_POST["modelo"]))&&(isset($_POST["imagen"])))
  3. {
  4. $servername = "localhost";
  5. $username = "root";
  6. $password = "";
  7. $conn = mysqli_connect($servername, $username, $password, "coche");
  8. $sql = "INSERT INTO `coche`.`coche` (`marca`, `modelo`, `foto`) VALUES ('".$_POST["marca"]."', '".$_POST["modelo"]."', '".$_POST["imagen"]."')";
  9. if (mysqli_query($conn, $sql) === TRUE) {
  10. echo "</br>".$_POST["marca"]." ".$_POST["modelo"]." insertado correctamente";
  11. } else {
  12. echo "</br>Error: " . $conn->error;
  13. }
  14. }
  15. else
  16. echo "Porfavor usa el formulario";
  17. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement