
Insertar Datos en Php
Publicado por Alex (5 intervenciones) el 18/05/2016 03:17:01
Necesito Ayuda, podrian ver cual es el erro de esta consulta?
POR QUE NO INSERTA NINGÚN DATO, NO SE EN QUE ES LO QUE ESTE MAL
ARCHIVO CONEXION.PHP
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php
include("conexion.php");
$DPI = $_POST['txtDpi'];
$Nombre = $_POST['txtNombre'];
$Direccion = $_POST['txtDirecion'];
$Telefono = $_POST['txtTelefono'];
$Celular = $_POST['txtCelular'];
$FechaN = $_POST['txtFechaN'];
$FechaI = $_POST['txtFechaI'];
$Usuario = $_POST['txtUsuario'];
$Pass = $_POST['txtPass'];
$Tipo = $_POST['rdTipo'];
$Agencia = $_POST['Agencia'];
$Puesto = $_POST['Puesto'];
$query="INSERT INTO empleado (DPI, NombreCompleto, Direccion, Telefono, Celular, FechaNacimiento, FechaIngreso, Nombre,
Password, Tipo, Agencia_idAgencia, Puesto_idPuesto) VALUES ('$DPI', '$Nombre', '$Direccion', '$Telefono', '$Celular', '$FechaN',
'$FechaI', '$Usuario', '$Pass', '$Tipo', '$Agencia', '$Puesto')";
if ($con->query($query)==TRUE) {
# code...
header("Location: ../empleados.php");
}
else
{
}
?>
ARCHIVO CONEXION.PHP
1
2
3
4
5
6
7
8
9
10
11
12
13
<?php
// datos para la conexion a mysql
$servername= "localhost";
$username= "root";
$password= "";
$dbname= "prestaya";
$con = mysqli_connect($servername,$username,$password,$dbname);
if (mysqli_connect_errno()) {
echo"Fail".mysqli_connect_errno();
}
?>
Valora esta pregunta


0