Ver Mensaje Individual
  #1 (permalink)  
Antiguo 16/06/2006, 17:23
Avatar de marcosr
marcosr
 
Fecha de Ingreso: agosto-2005
Ubicación: Montevideo, Uruguay
Mensajes: 451
Antigüedad: 18 años, 8 meses
Puntos: 5
Pregunta Formulario para actualizar información.

Hola de nuevo, sigo con los problemas de el código autogenerado por front page y esta vez si que ni idea del error... El tema es que hice una página con campos de texto y un botón actualizar para poder hacer que la información que el usuario envía no sea publicada en la página hasta que yo le doy al campo "vista" en la base de datos el valor "SI", de lo contrario tiene el valor "NO" y no es mostrada en la página sino que es cargada mediante este formularo que el juego de registros trae solo los "NO". La idea sería que yo por ese formulario pudiese cambiar el "NO" por un "SI" y que la información apareciese en la página.
El error lo encuentro al cambiar el campo vista desde el formulario. Puedo cambiar todos los campos del formulario excepto vista. Cuando intento cambiarlo, recarga la página que es lo que hace con todos los demás y me devuelve el "NO". A que se peude deber? Será que por el juego de registros?
Agradecería todo en lo que me pudieran ayudar, saludos,
Marcos.

Código:
<?php require_once('../../Connections/musica.php'); ?>

<?php

mysql_select_db($database_musica, $musica);
$query_bandas = "SELECT * FROM bandas WHERE vista = 'NO'";
$bandas = mysql_query($query_bandas, $musica) or die(mysql_error());
$row_bandas = mysql_fetch_assoc($bandas);
$totalRows_bandas = mysql_num_rows($bandas);
?>

<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}

$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
  $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "bnd")) {
  $updateSQL = sprintf("UPDATE bandas SET web=%s, género=%s, mail=%s, integrantes=%s, texto=%s, otros=%s, vista=%s, mensaje_e=%s WHERE banda=%s",
                       GetSQLValueString($_POST['web'], "text"),
                       GetSQLValueString($_POST['genero'], "text"),
                       GetSQLValueString($_POST['integrantes'], "text"),
                       GetSQLValueString($_POST['texto'], "text"),
                       GetSQLValueString($_POST['otra'], "text"),
                       GetSQLValueString($_POST['vista'], "text"),
                       GetSQLValueString($_POST['mensaje_e'], "text"),
                       GetSQLValueString($_POST['banda'], "text"),
                       GetSQLValueString($_POST['mail'], "text"));

  mysql_select_db($database_musica, $musica);
  $Result1 = mysql_query($updateSQL, $musica) or die(mysql_error());
}
?>