No graba en la base de datos?
Publicado por Ricardo Ríos (23 intervenciones) el 02/11/2006 21:00:32
Buenas me encuentro haciendo una aplicacion en php pero esta no quiere grabar en la base de datos, cuando ingreso los datos no me sale ningun error, este es el script del ingreso:
<html>
<body>
<?php
if (isset($_POST["enviar"]))
{
$link = mysql_connect("localhost", "neo","matrix");
mysql_select_db("america2",$link);
$sql = "INSERT INTO datos_personales (cedula, nombres, apellidos) ";
$sql = "VALUES ('".$_POST["cedula"]."','".$_POST["nombres"]."', '".$_POST["apellidos"]."')";
$result = mysql_query($sql);
echo "¡Gracias! Hemos recibido sus datos.\n";
}
else
{
?>
<form method="post" action="prueba4.php">
Cedula:<input type="Integer" name="cedula"><br>
Nombres:<input type="Text" name="nombres"><br>
Apellidos:<input type="Text" name="apellidos"><br>
<input type="Submit" name="enviar" value="Aceptar información">
</form>
<?php
}
?>
</body>
</html>
y este es el script que tengo en consulta
<html>
<body>
<?php
$link = mysql_connect("localhost","neo","matrix");
mysql_select_db("america2",$link);
$result = mysql_query("SELECT cedula, nombres, apellidos FROM datos_personales", $link);
echo "<table border = '1'> \n";
echo "<tr> \n";
echo "<td><b>Cedula</b></td> \n";
echo "<td><b>Nombres</b></td> \n";
echo "<td><b>Apellidos</b></td> \n";
echo "</tr> \n";
while ($row = mysql_fetch_row($result)){
echo "<tr> \n";
echo "<td>$row[0]</td> \n";
echo "<td>$row[1]</td> \n";
echo "<td>$row[2]</td> \n";
echo "</tr> \n";
}
echo "</table> \n";
?>
</body>
</html>
Al parecer no da ningun error pero no graba los valores, no se que podra pasar
<html>
<body>
<?php
if (isset($_POST["enviar"]))
{
$link = mysql_connect("localhost", "neo","matrix");
mysql_select_db("america2",$link);
$sql = "INSERT INTO datos_personales (cedula, nombres, apellidos) ";
$sql = "VALUES ('".$_POST["cedula"]."','".$_POST["nombres"]."', '".$_POST["apellidos"]."')";
$result = mysql_query($sql);
echo "¡Gracias! Hemos recibido sus datos.\n";
}
else
{
?>
<form method="post" action="prueba4.php">
Cedula:<input type="Integer" name="cedula"><br>
Nombres:<input type="Text" name="nombres"><br>
Apellidos:<input type="Text" name="apellidos"><br>
<input type="Submit" name="enviar" value="Aceptar información">
</form>
<?php
}
?>
</body>
</html>
y este es el script que tengo en consulta
<html>
<body>
<?php
$link = mysql_connect("localhost","neo","matrix");
mysql_select_db("america2",$link);
$result = mysql_query("SELECT cedula, nombres, apellidos FROM datos_personales", $link);
echo "<table border = '1'> \n";
echo "<tr> \n";
echo "<td><b>Cedula</b></td> \n";
echo "<td><b>Nombres</b></td> \n";
echo "<td><b>Apellidos</b></td> \n";
echo "</tr> \n";
while ($row = mysql_fetch_row($result)){
echo "<tr> \n";
echo "<td>$row[0]</td> \n";
echo "<td>$row[1]</td> \n";
echo "<td>$row[2]</td> \n";
echo "</tr> \n";
}
echo "</table> \n";
?>
</body>
</html>
Al parecer no da ningun error pero no graba los valores, no se que podra pasar
Valora esta pregunta


0