Ver Mensaje Individual
  #1 (permalink)  
Antiguo 09/04/2003, 22:08
Avatar de Reynier
Reynier
 
Fecha de Ingreso: noviembre-2002
Ubicación: Por ahí en algún sitio
Mensajes: 1.844
Antigüedad: 21 años, 5 meses
Puntos: 1
Exclamación Insercción en BD MySQL

Hola estoy haciendo un script en PHP que me permita insertar usuarios en una base de datos MySQL. La BD me está contando las inserciones pero no me inserta nada.

La BD: Esta formada por los campos id_user, nombre, apellidos, email

Este es el archivo index.php que nuevamente lo revisé y cambié algunas cosas.
Código PHP:
<?php
 $nombre 
$HTTP_POST_VARS['name'];
 
$apellidos $HTTP_POST_VARS['lastname'];
 
$email $HTTP_POST_VARS['mail'];
   
?>
<html>
<head>
<title>Documento sin t&iacute;tulo</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<form name="form1" method="post" action="insert.php">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="9%">Nombre:</td>
<td width="91%"><input name="name" type="text" id="name" size="25" maxlength="25"></td>
</tr>
<tr>
<td>Apellidos:</td>
<td><input name="lastname" type="text" id="lastname" size="25" maxlength="25"></td>
</tr>
<tr>
<td>E_Mail:</td>
<td><input name="mail" type="text" id="mail" size="25" maxlength="25"></td>
</tr>
<tr>
<td colspan="2"><input type="submit" name="Submit" value="Enviar"></td>
</tr>
</table>
</form>
</body>
</html>

y este otro el insert.php
Código PHP:
<?php
 $host 
"localhost";
 
$user "";
 
$pass "";
 
$db "prueba";
 
 
$conecta mysql_connect($host,$user,$pass);
 if (!
$conecta)
  {
   echo 
"Error:" .mysql_error();
  }
 
$selec mysql_select_db($db,$conecta);
 
 
mysql_query("INSERT INTO prueba (name,lastname,mail) VALUES ('$nombre','$apellidos','email')");
?>
__________________
Ing. Reynier Pérez Mira

Última edición por Reynier; 10/04/2003 a las 14:37