Advertisement
Guest User

Untitled

a guest
Oct 20th, 2014
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. <html>
  2. <?php
  3.  
  4. $usuario = $_POST['usuario'];
  5. $nombre = $_POST['nombre'];
  6. $apellido = $_POST['apellido'];
  7. $foto = 'fotiwi';
  8. $region = $_POST['region'];
  9.  
  10. echo "usuario ".$usuario." Nombre ".$nombre." Apellido ".$apellido." foto ".$foto." region ".$region."asdssjhfjkadf";
  11.  
  12. $usuario_bd = 'root';
  13. $passwd_bd = '123456';
  14. try {
  15. // print "Conectando";
  16. $conn = new PDO('mysql:host=localhost;dbname=taller_4;charset=utf8', $usuario_bd, $passwd_bd);
  17. $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  18. } catch (PDOException $e) {
  19. print "¡Error!: conexion " . $e->getMessage() . "<br/>";
  20. die();
  21. }
  22.  
  23. $sql="INSERT INTO usuario (user, nombre, apellido, foto, region) VALUES ('".$usuario."', '".$nombre."', '".$apellido."', '".$foto."',".$region.")";
  24.  
  25. try
  26. {
  27. $stmt = $conn->prepare($sql);
  28. $stmt->execute();
  29. } catch(PDOException $e)
  30. {
  31. print "¡Error!: agregacionnnnnnnmnjhjmjghmbhkkjgchd slzoyh " . $e->getMessage() . "<br/>";
  32. die();
  33. }
  34.  
  35. ?>
  36. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement