Ver Mensaje Individual
  #1 (permalink)  
Antiguo 14/04/2011, 20:48
sniffer_ven
 
Fecha de Ingreso: mayo-2009
Mensajes: 131
Antigüedad: 15 años
Puntos: 0
problemas Warning: sprintf()

Tengo un problema de tipo: Warning: sprintf() [function.sprintf]: Too few arguments me dice que el error esta en una de las $query pero no lo logro ver. Alguien sabe que significa esto Gracias de antemano.

NOTA: apenas me inicio en el php por si acaso.

Código PHP:
<?php require_once('../Connections/transporte.php'); ?>
<?php
$cedula 
htmlspecialchars(trim($_POST['cedula']));
$nombrehtmlspecialchars(trim($_POST['nombre']));
$apellidohtmlspecialchars(trim($_POST['apellido']));
$emailhtmlspecialchars(trim($_POST['email']));
$direccionhtmlspecialchars(trim($_POST['direccion']));
$telefonohtmlspecialchars(trim($_POST['telefono']));
$activohtmlspecialchars(trim($_POST['activo']));
$clave trim($_POST['clave']);
$nivelhtmlspecialchars(trim($_POST['nivel']));

/*Hacemos la consulta */
mysql_select_db($database_transporte$transporte);
$query sprintf("SELECT login FROM usuario WHERE login='%s'",  // Ahora
mysql_real_escape_string($_POST['login'],$transporte));
$result=mysql_query($query,$transporte);
if(
mysql_num_rows($result))
{
    echo 
"<script type='text/javascript'>
        alert('El usuario ya se encuentra en la base de datos');
        window.location= 'reg_usu.php';
        </script>"
;
}else{
    
mysql_free_result($result);
        
/* encriptamos la clave */
        
if (isset($_POST['clave']))
            {
                
$_POST['clave'] = sha1($_POST['clave']);           
            };

    
$query sprintf ("INSERT INTO cliente 
              (cedula, nombre, apellido, email, direccion, telefono, activo) 
              VALUES 
              ('%s','%s','%s','%s','%s','%s','%s')"


    
$query sprintf ("INSERT INTO usuario 
               (login, clave, nivel) 
              VALUES 
              ('%s','%s','%s')"
,

mysql_real_escape_string($_POST['cedula'],$transporte), mysql_real_escape_string($_POST['nombre'],$transporte),
mysql_real_escape_string($_POST['apellido'],$transporte), mysql_real_escape_string($_POST['email'],$transporte),
mysql_real_escape_string($_POST['direccion'],$transporte), mysql_real_escape_string($_POST['telefono'],$transporte),
mysql_real_escape_string($_POST['activo'],$transporte), mysql_real_escape_string($_POST['login'],$transporte),
mysql_real_escape_string($_POST['clave'],$transporte), mysql_real_escape_string($_POST['nivel'],$transporte)));

    
mysql_select_db($database_transporte$transporte);
    
$result=mysql_query($query,$transporte);
    
//$result=mysql_query($query1,$transporte);

    
if(mysql_affected_rows())
    {
        echo 
"<script type='text/javascript'>
        alert('El registro se ha incluido con exito');
        window.location= 'index.php';
        </script>"
;
    }else{
    echo 
"<script type='text/javascript'>
    alert('Error introduciendo usuario');
    window.location= 'reg_usu.php';
    </script>"
;
/* Cierre del else que corresponde a if(mysql_affected_rows.....) */
/* Cierre del else que corresponde a if(mysql_num_rows...) */
?>