Ver Mensaje Individual
  #1 (permalink)  
Antiguo 28/01/2008, 17:22
gesking
 
Fecha de Ingreso: diciembre-2006
Mensajes: 294
Antigüedad: 18 años, 2 meses
Puntos: 2
Problema UPDATE

Hola, les muestro mi script, haber si me pueden solucionar. Me salta que se actualizó y no lo hace...


Código PHP:
session_start();
if (isset($_SESSION['admin'])) {
include("../config.php");
?>
<a href="index.php">Ir al panel de administración</a><br><br>
<form action="administrar.php" method="post">
<table width="400" border="0" align="center" cellpadding="3" cellspacing="3">
  <tr>
    <td bgcolor="#CCCCCC"><div align="center">Elija que tipo de noticia para mostrar en la página principal</div></td>
  </tr>
  <tr>
    <td align="center">&nbsp;</td>
  </tr>
  <tr>
    <td align="center"><table width="100%" cellspacing="0" cellpadding="0" style="border:#000000, 1px">
      <tr>
        <td width="50%" align="center" bgcolor="#E1E1E1"><strong>Noticias LOCALES</strong></td>
        <td width="50%" align="center" bgcolor="#E1E1E1"><strong>Noticias REGION</strong></td>
      </tr>
      <tr>
        <td align="center" bgcolor="#E1E1E1"><input name="valor" type="radio" class="file" value="1" checked="checked" /></td>
        <td align="center" bgcolor="#E1E1E1"><input name="valor" type="radio" class="file" value="2" /></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td align="center"><input name="seleccionar" type="submit" class="boton" value="Seleccionar" /></td>
  </tr>
</table>
</form>
<br><br>
<?
if(isset($_POST['seleccionar'])){
echo 
"<div align=center>";
if(
$valor==1){
echo 
"<h2>Noticias LOCALES</h2><br><br>";
}else{
echo 
"<h2>Noticias REGION</h2><br><br>";


$obtenido $_POST['valor'];

$con mysql_query("SELECT * FROM radio_mp3 where valor = '$obtenido' ORDER BY id DESC") or die("Error: ".mysql_error());
if(
mysql_num_rows($con) != 0) {
echo 
'<form action="administrar.php" method="post" name="formulario" enctype="multipart/form-data">
<select name="archivo" class="file" id="usuario">'
;
while(
$datos mysql_fetch_array($con)) {
echo 
'<option value="'.$datos[archivo].'">'.$datos[archivo].'</option>';
}
echo 
'</select><br><br><input type="submit" value="Utilizar esta noticia" name="cambiar"></from>';

} else {
if(
$valor==1){
echo 
'No hay noticias LOCALES. Para subir una noticia <a href=subir.php>clic aqui</a>';
}else{
echo 
'No hay noticias de la REGION. Para subir una noticia <a href=subir.php>clic aqui</a>';

}
echo 
"</div>";
}

if(isset(
$_POST['cambiar'])){
$con mysql_query("SELECT archivo FROM radio_mp3 WHERE valor = '$obtenido'") or die("Error: ".mysql_error());
$mostrar mysql_fetch_array($con);

$sql "UPDATE radio_mostrar set archivo='$archivo' WHERE valor = '$obtenido'";
$res mysql_query($sql) or die("Error: ".mysql_error());
$modificacion true;
if(
$modificacion) {
echo 
'La noticia se ha modificado correctamente.';
} else {
echo 
'Se produjo un error. Vuelva a intentarlo o contáctese con el administrador. Gracias.';
}
}
}else{
echo 
'Tu no estas autentificado. No puedes entrar aqui!!';
}
Gracias.