Ver Mensaje Individual
  #1 (permalink)  
Antiguo 06/10/2010, 04:16
silvox
 
Fecha de Ingreso: mayo-2010
Mensajes: 3
Antigüedad: 14 años
Puntos: 0
Problema con formulario/BD.

Saludos,

Soy novato en PHP y desarrollando la web me ha surgido un problema a la hora de registrar usuarios en la base de datos.

Espero vuestros consejos y vuestras soluciones ^^

El código que uso es este:

Código PHP:
<html> 
<head> 
</head> 
<body> 
 <?php
        
function registrarse($name,$email,$pass){
            
            
            
            
$dbc=mysql_connect('hostname','usuario','pass');
            
mysql_select_db('nombre_bd');
            
            
            
$query"insert into usuarios (ID_USER,EMAIL,NICK,PASS) values (NULL,'$email','$name','$pass')";
            
            if(@
mysql_query($query)){
                print 
'<p>Registrado correctamente</p>';
                
            }else{
                print 
'<p style="color: red" >Error al registrar</p>';
            }
        
            
mysql_close();        

}

?>
 
<form method="post" action="formulario.php"> 
Inserta tus datos: <br> 
<table style= "border: 0"> 
<td>Nombre</td> 
<td><input name="name" size="20" maxlength="30"></td><tr> 
<td>email</td> 
<td><input name="pass" size="30" maxlength="50"></td><tr> 
<td>pass</td> 
<td><input name="email" size="30" maxlength="50"></td><tr> 
</table> 
 
<p style="text-align: center"><input type="submit" onclick="registrarse()" value="aceptar"><input type="reset" value="Reiniciar formulario"> 
</form> 
 
</body> 
 
</html>
¿donde estoy fallando?¿que he de hacer para que funcione? he preguntado en otros foros y ni me han constado, por poco que sea lo que me aporteis sera muy de agradecer por mi parte ^^

Última edición por silvox; 06/10/2010 a las 04:22