Jump to content

Ajuda com registo na base de dados


tochano
 Share

Recommended Posts

Boa noite,

Estou a tentar criar um sistema de registos numa base de dados

Não consigo resolver o seguinte problema:

Warning: mysqli_error() expects exactly 1 parameter, 0 on line 26

O código referente ao erro é o seguinte:

  if(!preg_match('/^[a-zA-Z0-9_\-\.]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$/i',$_POST['email']))
$erro[] = "*Email invalido. Formato de email incorreto.";
else{

 $query = "SELECT email FROM logins where email = '".$_POST['email']."'";
 $resultado = mysqli_query($db, $query) or die(mysqli_error());
$n_res = mysqli_num_rows($resultado);
if($n_res != 0)
$erro[] = "*Email ja registado, tente outro.";}

}

Obrigado pela ajuda.

Link to comment
Share on other sites

if(!preg_match('/^[a-zA-Z0-9_\-\.]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$/i',$_POST['email']))
 $erro[] = "*Email invalido. Formato de email incorreto.";
else
{
 $query = "SELECT email FROM logins where email = '".$_POST['email']."'";
 $resultado = mysqli_query($db, $query) or die(mysqli_error($db)); // <------------
 $n_res = mysqli_num_rows($resultado);
 if($n_res != 0)
   $erro[] = "*Email ja registado, tente outro.";}
}
IRC : sim, é algo que ainda existe >> #p@p
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.