Ver Mensaje Individual
  #1 (permalink)  
Antiguo 20/10/2010, 16:11
Avatar de fermin3d
fermin3d
 
Fecha de Ingreso: octubre-2010
Ubicación: sevilla
Mensajes: 141
Antigüedad: 13 años, 6 meses
Puntos: 4
que es lo que tengo mal?

tengo este codigo y no consigo inserta nada en mysql

formulario:
Código HTML:
Ver original
  1.  <TITLE>New Document</TITLE>
  2. </HEAD>
  3. <p>
  4. <br>
  5. <form action=prueba2.php>
  6. <font>nombre <input name=nombre size="30" type="text">
  7. <br><br>
  8. <font>apellidos <input name=apellidos size="30" type="text">
  9. <br><br>
  10. <input type=submit name=boton value=enviar>
  11. </form>
  12. </BODY>
  13. </HTML>

Luego el php
Código PHP:
Ver original
  1. <HTML>
  2. <HEAD>
  3.  <TITLE>New Document</TITLE>
  4. </HEAD>
  5. <BODY>
  6. <?php
  7. $host="localhost";
  8. $user="root";
  9. $password="";
  10. $db="yo";
  11. $enlace=mysql_connect($host,$user,$password) or die('error al conectar - '.mysql_error());
  12. mysql_select_db($db,$enlace) or die('error al seleccionar BD - '.mysql_error());
  13. $consulta = mysql_query('INSERT INTO id (`nombre`,`apellidos`) VALUES ("'.$nombre.'","'.$apellidos.'")',$enlace) or die(mysql_error());
  14. ?>
  15. </BODY>
  16. </HTML

y no inserta en la tabla ni me tira erro.