Ver Mensaje Individual
  #1 (permalink)  
Antiguo 13/08/2012, 15:43
Avatar de hulray
hulray
 
Fecha de Ingreso: septiembre-2006
Mensajes: 630
Antigüedad: 17 años, 7 meses
Puntos: 3
problema para insertar registro en base de datos

buen dia colegas, me pueden ayudar con este problema que tengo.

no me guarda la dato"r_text_index" en la base de datos la tengo en el nonbre de "text_index". Todos los demas me guardan bien...


textoindex1.php
Código PHP:
<?
include('../config.php'); //incluimos el config.php que contiene los datos de la conexión a la db

$r_id_index " Ingresar";

if((
$r_id_index == ' Ingresar') )
{

    
$sql "SELECT * from users where nick='".$_SESSION["usuario"]."'";
    
    
$rs=mysql_query($sql);
    while(
$row=mysql_fetch_array($rs))
    {
    
$r_id       $row["id"];
    
$r_nombre   $row["nombre"];
    
$r_pass     $row["pass"];
    
$r_usuario  $row["nick"];
    
$r_mail     $row["email"];
    
$r_cargo    $row["rollo"];
    
$r_fecha    $row["fecha"];
    
$r_level     $row["level"];
    
$r_active    $row["active"];
     }

            
$sql2="select * from textindex";
            
$rs2=mysql_query($sql2);
            while(
$row2=mysql_fetch_array($rs2))
            {
            
//$r_id_index       = $row2["id_index"];
            
$r_fecha_index    $row2["fecha_index"];
            
$r_hora_index     $row2["hora_index"];
            
$r_text_index     $row2["text_index"];
             }


include_once (
"textoindex2.php");





if((
$r_text_index != ' ') )
{

mysql_query("INSERT INTO textindex (fecha_index,hora_index,nombre,nick,text_index) values ('$r_fecha_index_actual','$r_hora_index','$r_nombre','$r_usuario','$r_text_index') ");
echo 
'Usuario registrado con éxito';
}
}

?>
textoindex2.php
Código PHP:
<?php
include_once ("../menu.php");


$r_fecha_index    date(Ymd);
    
$r_fecha_index_aa    substr($r_fecha_index,0,4);
    
$r_fecha_index_mm    substr($r_fecha_index,4,2);
    
$r_fecha_index_dd    substr($r_fecha_index,6,2);
    
$r_fecha_index_actual $r_fecha_index_dd.$r_fecha_index_mm.$r_fecha_index_aa;

    
$r_hora_index=(date("H:i"));



?>
     </ul>
    </div>
   
    <div class="appsBody">
      <div class="appsBody">
        <p>&nbsp;</p>
      </div>
    </div>
</div>
  
  
  <div class="appsBody">
  <div class="topwrap_acceso"></div>
  <div class="wrapper">
    <p><?
echo 'Bienvenido ';
echo 
$r_nombre

?>.
    Agregue una noticia en la pagina index. 
   
   
  <form method="post" target="_parent" action="textoindex1.php?id_index=<? echo $r_id_index?>">

   <?
   
   
echo "<input type =\"text\" name =\"r_id_index\" size=8 maxlength = 8 value=\"$r_id_index\">";
   echo 
"<input type =\"text\" name =\"r_fecha_index\" size=8 maxlength = 8 value=\"$r_fecha_index_actual\">";
   echo 
"<input type =\"text\" name =\"r_hora_index\" size=8 maxlength = 8 value=\"$r_hora_index\">";
   echo 
"<input type =\"text\" name =\"r_nombre\" size=8 maxlength = 8 value=\"$r_nombre\">";
   echo 
"<input type =\"text\" name =\"r_usuario\" size=8 maxlength = 8 value=\"$r_usuario\">";
  
 echo 
"<textarea name=\"r_text_index\" id=\"r_text_index\"></textarea><br>";
  
  echo   
"<input type=\"submit\" name=\"submit\" value=\"Agregar\">";
?>

      </label>
      <p>  
</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
    </form>