sintaxis sql en php
Publicado por caru (2 intervenciones) el 13/11/2013 21:05:18
Tengo el codigo de abajo en php pero no funciona la consulta sql el update, segun indica el mysql error ().
Me pueden ayudar?
Me pueden ayudar?
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<?php
include("../../../includes/php/conexion.php");
function ValidarCampos(){
$datos=true;
foreach ($_POST as $key=>$valor){
if ($valor==""){
$datos=false;
}
}
return $datos;
}
if ($_POST['bt_enviar']){
$datos=ValidarCampos();
if($datos==true){
$id =$_POST['id'];
$tipo_documento =$_POST['tipo_documento'];
$nro_documento =$_POST['numero'];
$apellido =$_POST['apellido'];
$nombres =$_POST['nombres'];
$fechaNac =$_POST['fechanac'];
$sexo =$_POST['sexo'];
$movil =$_POST['Cel'];
$tel =$_POST['Tel'];
$domicilio =$_POST['dom'];
$provincia =$_POST['prov'];
$email =$_POST['email'];
$localidad =$_POST['loc'];
$pais =$_POST['pais'];
}
$query="UPDATE personas";
$query.="SET idTipoDocumento='$tipo_documento',numeroDocumento='$nro_documento',apellido='$apellido',nombres='$nombres',fechaNacimiento='$fechaNac',sexo='$sexo',telefonoMovil='$movil',telefono='$tel',email='$email',domicilio='$domicilio',provincia='$provincia',localidad='$localidad',pais='$pais'";
$query.="where idpersona='$id'";
echo $query;
$con=conectarDB();
mysql_select_db("sgp",$con);
mysql_query($query,$con) or die(mysql_error());
mysql_close();
$msj="Datos actualizados.";
}else{
$msj="Faltan ingresar datos.";
}
?>
<html>
<head>
<meta charset="UTF-8"/>
<title>Listo</title>
</head>
<body>
<?php include("../../php/header.html");?>
<table align="center">
<tr>
<td>
<?php echo $msj ?>
</td>
<td><a href="ListarPersonas.php">Modificar otra persona</a></td>
</tr>
</table>
</body>
<?php include ("../../php/footer.html") ?>
</html>
Valora esta pregunta


0