Ver Mensaje Individual
  #1 (permalink)  
Antiguo 14/11/2012, 17:54
Avatar de Middrel
Middrel
 
Fecha de Ingreso: abril-2005
Mensajes: 835
Antigüedad: 19 años
Puntos: 27
Error en guardar datos en Mysql

Hola a todos, buenas noches...

Hace poco hice un administrador para subir información a una página de internet. El administrador funcionaba perfectamente, sin embargo, hay dos módulos de los cuales desconozco la razón por la cuál dejaron de funcionar.

Desde una página echa en PHP, envío la información por un formulario, la cuál veo que sale bien haciendo la prueba de var_dump();

Para que sea más claro les explico:

El formulario es el siguiente:

Código HTML:
<div id="wid-noticias">
	<p><strong>Noticias</strong></p>     
            <form action="interface.php" method="post">
		<textarea name="noticia" id="noticia" class="input-a" rows="10" placeholder="Descripción de la nota"><?php echo $noticia; ?></textarea>
                    <input type="text" name="autorNot" id="autorNot" class="input-a" value="<?php echo $autorNot; ?>" placeholder="Autor" />                    
                    <input type="date" name="fecha" id="fecha" value="<?php echo $fecha; ?>"  /> 
                    <input type="text" name="fuente" id="fuente" class="input-a" value="<?php echo $fuente; ?>" placeholder="Fuente"  />
                    <p>Panel de Modificaciones</p>
                    <input type="submit" name="guardarNoticia" id="guardarNoticia" value="Guardar" />
                    <input type="submit" name="editarNoticia" id="editarNoticia" value="Editar" />
                    <input type="submit" name="borrarNoticia" id="borrarNoticia" value="Borrar" />
                    <p>Panel de Búsqueda</p>
                    <input type="submit" name="buscarNoticia" id="buscarNoticia" value="Buscar" />                                                            
                    <input type="hidden" name="hiddenNot" id="hiddenNot" value="<?php echo $idNota; ?>" />
					<select name="noticiaSel">
                    	<option value="0">-- Selecciona Noticia --</option>
                        <?php while($rowShowNoticias = mysql_fetch_array($sqlShowNoticias)) { ?>
                        <option value="<?php echo $rowShowNoticias['id_noticias']; ?>"><?php echo $rowShowNoticias['noticias_fecha']; ?></option>
                        <?php } ?>
                    </select>  
                    <p class="mensaje-accion"><?php echo $mensaje3; ?></p>                                                        
                </form>            
            </div> 
El código de PHP para recibir y enviar la información a la base de datos es el siguiente:

Código PHP:
    /* Sección para dar Altas, Modificaciones, Bajas y Búsqueda de Noticias [Sección Inicio] */    
    
        /* Altas */
        
if(isset($_POST['guardarNoticia'])) {
                
            
$sqlInsertNoticias mysql_query("Insert into noticias (noticias_nota, noticias_autor, noticias_fecha, noticias_fuente) Values ('$_POST[noticia]','$_POST[autorNot]','$_POST[fecha]','$_POST[fuente]')");
                
            
$mensaje3 'Noticia dada de alta.';
                
        }
        
        
/* Modificaciones */
        
if(isset($_POST['editarNoticia'])) {
            
            
$sqlUpdateNoticia01 mysql_query("Update noticias Set noticias_nota = '$_POST[noticia]' Where id_noticias = $_POST[hiddenNot]");
            
$sqlUpdateNoticia02 mysql_query("Update noticias Set noticias_autor = '$_POST[autorNot]' Where id_noticias = $_POST[hiddenNot]");
            
$sqlUpdateNoticia03 mysql_query("Update noticias Set noticias_fuente = '$_POST[fuente]' Where id_noticias = $_POST[hiddenNot]");            
            
$sqlUpdateNoticia04 mysql_query("Update noticias Set noticias_fecha = '$_POST[fecha]' Where id_noticias = $_POST[hiddenNot]");                        
            
            
$mensaje3 'Noticia actualizada.';
        }
        
        
        
/* Bajas */
        
        
if(isset($_POST['borrarNoticia'])) {
            
            
$sqlDeleteNoticia mysql_query("Delete from noticias Where id_noticias = $_POST[hiddenNot]");
            
            
$mensaje3 'Noticia eliminada.';
            
        }
        
        
/* Búsqueda */
        
        
if(isset($_POST['buscarNoticia'])) {
            
            
$sqlSelectNoticias mysql_query("Select * from noticias Where id_noticias = $_POST[noticiaSel]");
            
$rowSelectNoticias mysql_fetch_array($sqlSelectNoticias);
    
            
$idNota $rowSelectNoticias['id_noticias'];        
            
$noticia $rowSelectNoticias['noticias_nota'];
            
$autorNot $rowSelectNoticias['noticias_autor'];            
            
$fuente $rowSelectNoticias['noticias_fuente'];
            
$fecha $rowSelectNoticias['noticias_fecha'];            
            
            
$mensaje3 'Noticia encontrado.';
            
        } 
Ya revisé las tablas en la base de datos, las cuáles son correctas a los nombres que menciono en el código, sin embargo no puedo insertar una noticia.

Tengo muchos módulos más realizados de la misma forma, sin embargo esos funcionan a la perfección, simplemente este y otro módulo dejaron de funcionar y desconozco el porqué.

Cuando uso el var_dump($_POST); obtengo lo siguiente:

Código:
array(7) { ["noticia"]=> string(301) "
Entérate de lo más nuevo que JPE Consultores está realizando. Podrás partcipar en webinar's totalmente gratuitos y otras grandes promociones.

" ["autorNot"]=> string(9) "Sin autor" ["fecha"]=> string(10) "2012-11-14" ["fuente"]=> string(10) "Sin fuente" ["guardarNoticia"]=> string(7) "Guardar" ["hiddenNot"]=> string(0) "" ["noticiaSel"]=> string(1) "0" }
Llevo un buen rato haciendo pruebas y no encuentro la solución... alguien tiene alguna idea de donde estoy cometiendo el error? :/

De antemano, les agradezco por sus comentarios.

Saludos!!