Ver Mensaje Individual
  #9 (permalink)  
Antiguo 08/11/2007, 02:12
Avatar de Yranac
Yranac
 
Fecha de Ingreso: junio-2007
Mensajes: 125
Antigüedad: 17 años, 7 meses
Puntos: 1
Re: No me guarda los registros, que será?

Insisto en que uses mysql_error() para saber el error que te da por si es de mysql (o de la consulta)

Código PHP:
<?php
    
include("conectarmysql.php");
    
$conexion=conectarse("user","pass","n_db");
    
$rs=mysql_query("select * from promociones where fecha_inicio='$tfechaini'"$conexion);
    
$num=mysql_num_rows($rs);
    
    if(
$num>0)
       {
               
$row=mysql_fetch_array($rs);
               echo 
"Fecha ya existe".$row["fecha"];
            exit();
        }
    else
        {
            
$rs2 mysql_query("insert into promociones (fecha_inicio,tienda,ciudad,promocion) values('$tfechaini','$ttienda','$tciudad','$tpromocion')",$conexion);
            if(
$rs2)
            {
                 
header("Location: grabado.php");
                 exit();
            }
            else
                {
                    echo 
"Ocurrió un error al adicionar el registro";
                    echo 
"Mysql ha dicho: " mysql_error();
                }

            }
    
mysql_free_result($rs);

    
?>
__________________
mais só os ignorantes e féridos e duros, imbéciles e escuros non nos entenden, non.
Visita Mi web