PHP - resolver el error

 
Vista:

resolver el error

Publicado por Nallely (11 intervenciones) el 19/05/2014 19:19:19
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
<? include "funciones.php";?>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Documento sin t&iacute;tulo</title>
</head>
<?
$con = conectar();
$i = $_GET[id_alerta];
$qry= "select fecha, tema, onomastico, descripcion from alertas where id_alerta=".$i;
$b = mysql_query($qry,$con) or die(mysql_error());
$row = mysql_fetch_array($b);
?>
<body>
<form action="actualiza_alerta.php" method="post">
<table>
	<tr>
    	<td>Fecha</td>
        <td><input type="text" name="fecha" value="<?  echo $row['fecha']?>" /></td>
    </tr>
    <tr>
    	<td>Onomastico</td>
        <td><input type="text" name="ono" value="<?  echo $row['onomastico']?>" /></td>
    </tr>
    <tr>
    	<td>Tema</td>
        <td><input type="text" name="tema" value="<?  echo $row['tema']?>" /></td>
    </tr>
    <tr>
    	<td>Descripcion</td>
        <td><Textarea cols="20" rows="9" name="descripcion"><? echo $row['descripcion']?></Textarea><input type="hidden"  name="id_alerta" value="<? echo $_GET['id_alerta']?>" /></td>
    </tr>
</table>
<div align="center">
<input type="submit" value="Cambiar" name="enviar" />
</div>
</form>
<?
if(isset($_POST[enviar])){
	$con= conectar();
	$q="update alertas set fecha='".$_POST['fecha']."', onomastico='".$_POST['ono']."', tema='".$_POST['tema']."', descripcion='".$_POST['descripcion']."' where id_alerta='".$_POST['id_alerta']."'";
    mysql_query($q,$con) or die(mysql_error());
    ?>
 <script type="text/javascript">
	window.opener.location.reload();
	window.close();
 </script>
<? } ?>
</body>
</html>

-----------------------Este es el mensaje de error que aparece------------------------------------
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
No logro encontrar el error necesito ayuda, por favor
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

resolver el error

Publicado por Martha (48 intervenciones) el 19/05/2014 20:27:33
Prueba:

1
$qry= "select fecha, tema, onomastico, descripcion from alertas where id_alerta= ' $i ' ";
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

resolver el error

Publicado por Nallely (11 intervenciones) el 19/05/2014 20:39:57
Te lo agradezco mucho.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar