inserting data in mysqli with php

1

Good morning, I'm having a problem inserting data into mysqli with php.

I am using a form with 3 fields: name, email and password. The problem is that the data I enter in the email field will stop the field and password and vice versa. And at the time of doing the validation to give me problems help me.

Here is the code:

public function registro(){
       $db = new Conexao();
       $sql = $db->query("SELECT nome,email FROM usuario WHERE nome='$this->nome' OR email='$this->email';");
       $existe = $db->recorrer($sql);

       if(strtolower($existe['nome'])!=strtolower($this->nome) and strtolower($existe['email'])!=strtolower($this->email)){
        $db->query("INSERT INTO usuario (nome,email,senha) VALUES('$this->nome','$this->email');");   
        session_start();
        $_SESSION['nome'] = $this->nome;
        header('location: Acesso.php');

       } else if(strtolower($existe['nome'])==strtolower($this->nome)){
          header('location: index.php?modo=registro&error=Usuario_usado');  
       }else if(strtolower($existe['email'])==strtolower($this->email)){
        header('location: index.php?modo=registro&error=Email_usado');   

       }
  }

form

<html>
    <head><title>Smart</title></head>
    <body>
     <h1>Registro</h1>   
     {if isset($error)}
          {$error}
         {/if}
     <form action="index.php?modo=registro"method="POST">
         <label>Nome</label><input type="text" name="nome"/><br/><br/>
         <label>Senha</label><input type="password" name="senha"/><br/><br/>
          <label>E-mail</label><input type="email" name="email"/><br/><br/>

<input type="hidden"name="registro" value="1"/>
         <input type="submit"value="Registrar-me"/>
 </form>
</body>
</html>
    
asked by anonymous 16.05.2016 / 10:16

1 answer

3
INSERT INTO usuario (nome,email,senha) VALUES('$this->nome','$this->email');"

'thist-> password' ??

    
16.05.2016 / 12:48