Ver Mensaje Individual
  #2 (permalink)  
Antiguo 08/01/2010, 15:29
dadm
 
Fecha de Ingreso: enero-2010
Mensajes: 2
Antigüedad: 15 años, 1 mes
Puntos: 0
Respuesta: Añadir datos a una tabla a partir de formulario

De esta forma ingreso los datos un formulario a una DB en MySQL

Segun el fomulario seria POST o GET

$insertQuery = "INSERT INTO nom_tabla VALUES (NULL, " .
"\"" . $_POST[tiempo] . "\", " .
"\"" . $_POST[pais] . "\", " .
"\"" . $_POST[usuario] . "\", " .
"\"" . $_POST[socket] . "\", " .
"\"" . $_POST[fsb] . "\", " .
"\"" . $hoy . "\") ";

if ((@ mysql_query ($insertQuery,
$connection))
&& @ mysql_affected_rows() == 1)
{
header("Location: index.php?vista=ingresar"); // donde lo debe redireccionar una vez insertados los datos
}
else
{
header("Location: index.php?status=false");
}

Espero sea de ayuda