resolver el error
Publicado por Nallely (11 intervenciones) el 20/05/2014 21:11:59
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
<? 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=iso-8859-1" />
<title>Documento sin título</title>
</head>
<?
$con = conectar();
$i = $_GET[id_alerta];
$qry= "select fecha, tema, onomastico, descripcion from alertas where id_alerta=".$i;
echo $qry;
$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]."'";
echo $q;
$r = mysql_query($q, $con) or die(mysql_error());
?>
<script type="text/javascript">
window.opener.location.reload();
window.close();
</script>
<? } ?>
</body>
</html>
------------------------------------------------------------------------------------------------------------------------------------------------------------
Ayuda mi query sale mal, muestra lo siguiente:
select fecha, tema, onomastico, descripcion from alertas where id_alerta=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
Valora esta pregunta


0