Ver Mensaje Individual
  #1 (permalink)  
Antiguo 04/12/2003, 16:30
Beldar
 
Fecha de Ingreso: julio-2002
Mensajes: 40
Antigüedad: 21 años, 9 meses
Puntos: 0
Ampliarlas funciones de mi gestor de noticias

Hace unas semanas empece el desarrollo de un gestor de contenidos. Todo me va funcinando de momento excepto una opcion ke tengo para actualizar la informacion que hay en la base de datos. Aki pongo el codigo:

<html>
<head>
<title>Editar noticias</title>
<meta http-equiv=Content-Type content=text/html; charset=iso-8859-1>
</head>
<body>
<?php include("menu.php"); ?>
<?php
include("../db/conex.php");
$link=Conectarse();
$id=$_GET['id_new'];
$result=mysql_query("SELECT * FROM new WHERE id_new = $id;",$link);
?>
<?php

while ($row = mysql_fetch_array($result)) {
printf("<table width=500 border=0 cellspacing=0 cellpadding=0 align=center>
<form action=upgrade.php method=get>
<tr>
<td width=67>Title:</td>
<td width=433><input type=text name=atitle value=%s></td>
</tr>
<tr>
<td width=67>URL img:</td>
<td width=433><input type=text name=aimgpath value=%s></td>
</tr>
<tr>
<td width=67>Fecha:</td>
<td width=433><input type=text name=afecha value=%s></td>
</tr>
<tr>
<td>Short text : </td>
<td><textarea name=ashorttxt cols=100 rows=5>%s</textarea></td>
</tr>
<tr>
<td>Long text : </td>
<td><textarea name=alongtxt cols=100 rows=10>%s</textarea></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type=submit name=accion value=upgrade>
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</form>
</table>",$row["title"], $row["imgpath"], $row["fecha"], $row["shorttxt"], $row["longtxt"]);
}
mysql_free_result($result);
mysql_close($link);
?>
</body>
</html>

con este primero extraigo los datos para poder modificarlos.

<?php
include("../db/conex.php");
$link=Conectarse();
$id=$_GET['id_new'];
$atitle=$_GET['title'];
$aimgpath=$_GET['imgpath'];
$afecha=$_GET['fecha'];
$ashorttxt=$_GET['shorttxt'];
$alongtxt=$_GET['longtxt'];
mysql_query("update from new set
title = '$atitle',
imgpath = '$aimgpath',
fecha = '$afecha',
shorttxt = '$ashorttxt',
longtxt = '$alongtxt'
where id_new = '$id'",$link);

header("Location: edit.php");
?>

Con el segundo los recojo y los inserto de nuevo en la base de datos.

Tal y como esta no me funciona alguien ve el fallo ke yo no veo?