FILE PHP editing image and information coming with POST

1

My code is not editing the information the way it is with the following error, Unknown column '$ full_name' in 'field list', I am passing this value and all others ..

The Edit form:

     <form class="cmxform form-horizontal"  method="POST" action="editarDadosUsuario.php" enctype="multipart/form-data">

 <input type="hidden" style="width: 290px;" name="i" value="<?php echo $lista['id'] ?>" />
 <input type="hidden" style="width: 290px;" name="id_usuario" value="<?php echo $lista['id_usuario'] ?>" />


        <div class="form-group ">
            <label for="cname" class="control-label col-lg-3">Nome Completo (*)</label>
            <div class="col-lg-6">
                <input class=" form-control" id="cname" name="nome_completo"
                 value="<?php echo $lista['nome_completo']; ?>"  minlength="2" type="text" required="">
            </div>
        </div>

        <div class="form-group ">
            <label for="cname" class="control-label col-lg-3">Data de Nascimento (*)</label>
            <div class="col-lg-6">
                <input class=" form-control"  name="data_nascimento" value="<?php echo $lista['data_nascimento']; ?>"  minlength="2" type="text" required="">
            </div>
        </div>

        <div class="form-group ">
            <label for="cname" class="control-label col-lg-3">CPF (*)</label>
            <div class="col-lg-6">
                <input class=" form-control"  name="cpf" type="text" value="<?php echo $lista['cpf']; ?>"  >
            </div>
        </div>

        <div class="form-group ">
            <label for="cname" class="control-label col-lg-3">Sexo(*)</label>
            <div class="col-lg-6">
               <select name="sexo">
                   <option value="Masculino">Masculino</option>
                   <option value="Feminino">Feminino</option>
               </select>
            </div>
        </div>

        <div class="form-group ">
            <label for="cname" class="control-label col-lg-3">Tipo Sanguineo (*)</label>
            <div class="col-lg-6">
                <input class=" form-control" name="tipo_sangue" minlength="2" type="text" value="<?php echo $lista['tipo_sangue']; ?>"  required="">
            </div>
        </div>

        <div class="form-group ">
            <label for="cname" class="control-label col-lg-3">Tamanho da Camiseta (*)</label>
            <div class="col-lg-6">
               <select  name="tamanho_camiseta">
                   <option value="Infantil">Infantil</option>
                   <option value="Tamanho P">Tamanho P</option>
                   <option value="Tamanho M">Tamanho M</option>
                   <option value="Tamanho G">Tamanho G</option>
                    <option value="Tamanho GG">Tamanho GG</option>
               </select>
            </div>
        </div>

        <div class="form-group ">
            <label for="cname" class="control-label col-lg-3">Nome do Grupo | Equipe (*)</label>
            <div class="col-lg-6">
                <input class=" form-control" name="grupo_equipe" minlength="2" type="text" value="<?php echo $lista['grupo_equipe']; ?>"  required="">
            </div>
        </div>

        <div class="form-group ">
            <label for="cname" class="control-label col-lg-3">Telefone Fixo </label>
            <div class="col-lg-6">
                <input class=" form-control" value="<?php echo $lista['telefone_fixo']; ?>"  name="telefone_fixo" minlength="2" type="text" >
            </div>
        </div>

        <div class="form-group ">
            <label for="cname" class="control-label col-lg-3">Telefone Celular (*)</label>
            <div class="col-lg-6">
                <input class=" form-control" name="telefone_celular" value="<?php echo $lista['telefone_celular']; ?>"  minlength="2" type="text" required="">
            </div>
        </div>

         <div class="form-group ">
            <label for="cname" class="control-label col-lg-3">Telefone Celular 2 </label>
            <div class="col-lg-6">
                <input class=" form-control" name="telefone_celular2" minlength="2" value="<?php echo $lista['telefone_celular2']; ?>"  type="text" >
            </div>
        </div>

         <div class="form-group ">
            <label for="cname" class="control-label col-lg-3">CEP (*)</label>
            <div class="col-lg-6">
                <input class=" form-control" name="cep" value="<?php echo $lista['cep']; ?>"  minlength="2" type="text" required="">
            </div>
        </div>

         <div class="form-group ">
            <label for="ccomment" class="control-label col-lg-3">Endereço Completo (*)</label>
            <div class="col-lg-6">
                <textarea class="form-control"  name="endereco_completo"  ><?php echo $lista['endereco_completo']; ?></textarea>
            </div>
        </div>

        <div class="form-group ">
            <label for="ccomment" class="control-label col-lg-3">Complemento (*)</label>
            <div class="col-lg-6">
                <textarea class="form-control"   name="complemento" ><?php echo $lista['complemento']; ?></textarea>
            </div>
        </div>

         <div class="form-group ">
            <label for="cemail" class="control-label col-lg-3">Bairro </label>
            <div class="col-lg-6">
                <input class="form-control " value="<?php echo $lista['bairro']; ?>"  type="text" name="bairro" >
            </div>
        </div>


        <div class="form-group ">
            <label for="cemail" class="control-label col-lg-3">Cidade </label>
            <div class="col-lg-6">
                <input class="form-control " value="<?php echo $lista['cidade']; ?>"  type="text" name="cidade" >
            </div>
        </div>

        <div class="form-group ">
            <label for="cemail" class="control-label col-lg-3">Estado</label>
            <div class="col-lg-6">
                <input class="form-control " value="<?php echo $lista['estado']; ?>"  type="text" name="estado" >
            </div>
        </div>




        <div class="form-group ">
            <label for="cemail" class="control-label col-lg-3">E-Mail (*)</label>
            <div class="col-lg-6">
                <input class="form-control " id="cemail" value="<?php echo $lista['email']; ?>"  type="email" name="email" required="">
            </div>
        </div>

        <div class="form-group">
            <label for="cemail" class="control-label col-lg-3">Foto do Perfil</label>
            <div class="col-lg-6">
                <input type="file" name="imagem">
            </div>
        </div>


        <div class="form-group">
            <div class="col-lg-offset-3 col-lg-6">
                <button class="btn btn-primary" type="submit">Cadastrar</button>
                <button class="btn btn-default" type="button">Limpar</button>
            </div>
        </div>
    </form>

<?php } ?>

Now the file that receives this data and does the editing:

<?php

// Incluir o arquivo conecta.php que faz a conexão com o banco de dados

$mysqli = new mysqli('mysql.******.com.br','********87', '**********', '**********');

//inicia a edição
//Edição das imagens
$id = $_POST['id'];
$id_usuario = $_POST['id_usuario'];
$imagem = $_FILES['imagem'];

preg_match("/\.(gif|bmp|png|jpg|jpeg|){1}$/i",$imagem['name'], $ext);

$nome_imagem = md5(uniqid(time())) . ".". $ext[1];

$caminho_imagem = "foto_usuarios/".$nome_imagem;

move_uploaded_file($imagem['tmp_name'], $caminho_imagem);

@ini_set('display_errors', '1');
error_reporting(E_ALL);

$nome_completo = $_POST['nome_completo'];
$data_nascimento = $_POST['data_nascimento'];
$cpf = $_POST['cpf'];
$sexo = $_POST['sexo'];
$tipo_sangue = $_POST['tipo_sangue'];
$tamanho_camiseta = $_POST['tamanho_camiseta'];
$grupo_equipe = $_POST['grupo_equipe'];
$telefone_fixo = $_POST['telefone_fixo'];
$telefone_celular = $_POST['telefone_celular'];
$telefone_celular2 = $_POST['telefone_celular2'];
$cep = $_POST['cep'];
$endereco_completo = $_POST['endereco_completo'];
$bairro = $_POST['bairro'];
$cidade = $_POST['cidade'];
$estado = $_POST['estado'];
$email = $_POST['email'];
$status = 'Em processamento';
$nivel = '2';
$valida = '0';


$sql = 'UPDATE inscricoesUsuarios SET id_usuario = ?, nivel = ?, valida = ?, $nome_completo = ?, $data_nascimento = ?, $cpf = ?, $sexo = ?, 
$tipo_sangue = ?, $tamanho_camiseta = ?, $grupo_equipe = ?, $telefone_fixo = ?, $telefone_celular = ?, $telefone_celular2 = ?, 
$cep = ?, $endereco_completo = ?, $bairro = ?, $cidade = ?, $email = ?, $status = ?, $imagem = ? WHERE inscricoesUsuarios.id = ?';
$stmt = $mysqli->prepare($sql) or die($mysqli->error);

if(!$stmt){
  echo 'erro na consulta: '. $mysqli->errno .' - '. $mysqli->error;
}

$stmt->bind_param('ssi', $id_usuario, $nivel, $valida, $nome_completo, $data_nascimento, $cpf, $sexo, $tipo_sangue, $tamanho_camiseta,
$grupo_equipe, $telefone_fixo, $telefone_celular, $telefone_celular2, $cep, $endereco_completo, $bairro, $cidade, $email, $status,
$imagem, $id);
$stmt->execute();
header("Location: principal.php");

?>
    
asked by anonymous 25.06.2017 / 16:25

1 answer

1

I think the error in name has no relation to the error message

Unknown column '$nome_completo' in 'field list'

But I did a test here in my bank and it only worked by changing some things.

name="i" php $_POST['id']

By

<input type="hidden" style="width: 290px;" name="id" value="<?php echo $lista['id'] ?>" />


$id = $_POST['id'];

/ p>

'$nome_completo'

and put so many how many variables exist in $stmt->bind_param('sss.....', $id_usuario, $nivel, $valida, $nome_completo,.....

otherwise it generates Warning: mysqli_stmt::bind_param(): Number of elements in type definition string doesn't match number of bind variables

    
25.06.2017 / 17:40