Ver Mensaje Individual
  #4 (permalink)  
Antiguo 26/10/2011, 23:38
Avatar de animerika1
animerika1
 
Fecha de Ingreso: octubre-2011
Mensajes: 27
Antigüedad: 12 años, 6 meses
Puntos: 3
Respuesta: como evitar registro si el email existe

Prueba con este, recuerda en el select cambiar por tus nombres de tabla o variables



if(!empty($_POST['Cuenta']) || !empty($_POST['Nombres']) || !empty($_POST['Apellidos']) || !empty($_POST['Email']))
{

$busqueda= mysql_query("SELECT Email FROM usuarios WHERE Email='".$Email."'");

if(mysql_num_rows($busqueda)>0) {
echo "email existe";

}

else {

$Cuenta = Seguridad($_POST["Cuenta"]);
$Nombre = Seguridad($_POST["Nombre"]);
$Apellidos = Seguridad($_POST["Apellidos"]);
$Email = Seguridad($_POST["Email"]);

$sql = "INSERT INTO usuarios (Cuenta,
Nombre,
Apellidos,
Email) VALUES ('".$Cuenta."',
'".$Nombre."',
'".$Apellidos."',
'".$Email."')";
mysql_query($sql,$conectar) or die(mysql_error());
$msg = "</td>
</tr>
</table>
<table class=\"cart_last_product std\">
<tr>
<th colspan=\"2\">Cuenta Registrada Correctamente.</th>
</tr>
</table>";

}
}

else {
$msg = "</td>
</tr>
</table>
<table class=\"cart_last_product std\">
<tr>
<th colspan=\"2\">Aviso: Rellene todo el formulario.</th>
</tr>
</table>";
}
}