Foros del Web » Programando para Internet » PHP »

Porque no se me inserta el registro

Estas en el tema de Porque no se me inserta el registro en el foro de PHP en Foros del Web. Hola amigos tengo el siguiente codigo: <html> <head> <title>Insercion en PHP</title> </head> <body> <H1>DATOS</H1> <FORM ACTION="insertar.php" method="post"> <TABLE> <TR> <TD>Rut:</TD> <TD><INPUT TYPE="text" NAME="rut" SIZE="20" MAXLENGTH="30"></TD> ...
  #1 (permalink)  
Antiguo 02/12/2008, 10:32
 
Fecha de Ingreso: abril-2005
Mensajes: 73
Antigüedad: 19 años
Puntos: 0
Porque no se me inserta el registro

Hola amigos tengo el siguiente codigo:

<html>
<head>
<title>Insercion en PHP</title>
</head>
<body>
<H1>DATOS</H1>
<FORM ACTION="insertar.php" method="post">
<TABLE>
<TR>
<TD>Rut:</TD>
<TD><INPUT TYPE="text" NAME="rut" SIZE="20" MAXLENGTH="30"></TD>
</TR>
<TR>
<TD>Nombre:</TD>
<TD><INPUT TYPE="text" NAME="nombre" SIZE="20" MAXLENGTH="30"></TD>
</TR>
<TR>
<TD>Apellidos:</TD>
<TD><INPUT TYPE="text" NAME="apellidos" SIZE="20" MAXLENGTH="30"></TD>
</TR>
<TR>
<TD>Direccion:</TD>
<TD><INPUT TYPE="text" NAME="direccion" SIZE="20" MAXLENGTH="30"></TD>
</TR>
<TR>
<TD>Telefono:</TD>
<TD><INPUT TYPE="text" NAME="telefono" SIZE="20" MAXLENGTH="30"></TD>
</TR>
</TABLE>
<INPUT TYPE="submit" NAME="accion" VALUE="Grabar">
</FORM>
</table>
</body>
</html>
<?php
$rut=$_Post['rut'];
$nombre=$_Post['nombre'];
$apellido=$_Post['apellidos'];
$direccion=$_Post['direccion'];
$telefono=$_Post['telefono'];
$enlace1 = mysql_connect('localhost','root','');
if (isset($rut))
{
mysql_select_db("cony");
mysql_query("insert into datos (rut,nombre,apellido,direccion,telefono) values ('$rut','$nombre','$apellido';'$direccion','$telef ono')",$enlace1);
}
?>


Cuando lo hacia en macromedia me insertaba el registro pero ahora que lo hago en webserver no me inserta el registro, que pasa ...tengo bien estructurado el codigo???

Cony.
  #2 (permalink)  
Antiguo 02/12/2008, 10:39
Avatar de GatorV
$this->role('moderador');
 
Fecha de Ingreso: mayo-2006
Ubicación: /home/ams/
Mensajes: 38.567
Antigüedad: 18 años
Puntos: 2135
Respuesta: Porque no se me inserta el registro

Pues en primera veo que debe de ser $_POST y no $_Post.

De ahi en fuera trata de ver el resultado de tu llamada a la función mysql_query.

Saludos.
  #3 (permalink)  
Antiguo 02/12/2008, 10:42
 
Fecha de Ingreso: octubre-2008
Mensajes: 67
Antigüedad: 15 años, 6 meses
Puntos: 0
Respuesta: Porque no se me inserta el registro

hola Cony28

prueba de esta forma y ve si te resulta

Código PHP:
mysql_query("insert into tu_tabla values ('null','".$_POST['tu_campo']."', '".$_POST['tu_campo']."','".$_POST['tu_campo']."','".$_POST['tu_campo']."','".$_POST['tu_campo']."','".$_POST['tu campo']."','".$_POST['tu_campo']."')")
or die(
"Could not insert data because ".mysql_error()); 
saludos
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 04:50.