failed, register data in database

0

Hello, I'm having some problems trying to register the form data in bd,

Form Code:

<form class="form-horizontal" method="post" action="processa/proc_cad_star.php">
<div class="form-group">
    <label for="inputEmail3" class="col-sm-2 control-label">Nome</label>
        <div class="col-sm-10">
            <input type="texto" class="form-control" name="nome" placeholder="Nome Popular">
        </div>
</div>

<div class="form-group">
    <label for="inputEmail3" class="col-sm-2 control-label">Sexo</label>
        <div class="col-sm-10">
            <label class="radio-inline">
                <input type="radio" name="sexo" value="F">F
            </label>
            <label class="radio-inline">
                <input type="radio" name="sexo" value="M">M
            </label>
        </div>
</div>

<div class="form-group">
    <label for="inputEmail3" class="col-sm-2 control-label">País</label>
        <div class="col-sm-10">
            <input type="texto" class="form-control" name="pais" placeholder="País Atual">
        </div>
</div>


<div class="form-group">
    <label for="inputEmail3" class="col-sm-2 control-label">Cidade Natal</label>
        <div class="col-sm-10">
            <input type="texto" class="form-control" name="cidade" placeholder="Onde Nasceu">
        </div>
</div>


<div class="form-group">
    <label for="inputEmail3" class="col-sm-2 control-label">Tattoo</label>
        <div class="col-sm-10">
            <label class="radio-inline">
                <input type="radio" name="tattoo" value="Yes">Yes
            </label>
            <label class="radio-inline">
                <input type="radio" name="tattoo" value="None">None
            </label>
        </div>
</div>




<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
  <button type="submit" class="btn btn-success">Cadastrar</button>
</div>
</div></form>'

Page proc_cad_star.php:

<?php   session_start();
include_once("../seguranca.php");

include_once("../conexao.php");

$nome = $_POST["nome"];
$sexo = $_POST["sexo"];
$pais = $_POST["pais"];
$cidade = $_POST["cidade"];
$tattoo = $_POST["tattoo"];
//Apenas para simplificar o post aqui no site
//Primeira tentativa
$result = $mysqli->query("SELECT COUNT(*) FROM usuario WHERE nome = '$nome' ");
$row = $result->fetch_row();
   if ($row[0] > 0) {
        $alerta =("seu (".$nome.") já existente.");
    } else {
        $alerta =("Cadastro realizado com sucesso");
        $mysqli->query("INSERT INTRO usuario (nome, sexo, pais, cidade, tattoo, created) VALUES ('".$nome."','".$sexo."','".$pais."','".$cidade."', '".$tattoo."', NOW())");
    }    

 //Segunda tentativa        
$query = mysqli_query("INSERT INTRO usuario (nome, sexo, pais, cidade, tattoo, created) VALUES ('".$nome."','".$sexo."','".$pais."','".$cidade."', '".$tattoo."', NOW())");
if (mysqli_affected_rows() != 0){
header("location: ../listar_star.php");
}
?>

The first attempt does not show any error, but does not register.

The second attempt has the following errors:

  Warning: mysqli_query () expects at least 2 parameters, 1 given in

     Warning: mysqli_affected_rows () expects exactly 1 parameter, 0 given in

Does anyone know how to fix? I can not find the error. Thanks

    
asked by anonymous 14.05.2017 / 07:13

0 answers