Data does not appear in phpMyAdmin

0

I am having problems sending data passed by the form + php, and appear in the database .... When I go in phpMyadmin only appears the data that I once handbook, it is not being dynamic to display in phpMyadmin, I would like your help ... I have my head aching already ... Connection

$servidor = "localhost";
$user = "root";
$pass = "root";
$banco = "cadastro";


//criar conexao
$conn = mysql_connect($servidor,$user,$pass,$banco)or die(mysql_error());

 echo ("enviado com sucesso");


mysql_select_db($banco)or die(mysql_error());

The php variables

$Cobranca          = $_POST['Cobranca'];
 $Conducao          = $_POST['Conducao'];
 $conforto          = $_POST['conforto'];
 $Conservacao       = $_POST['Conservacao'];
 $CumprimentoParada = $_POST['CumprimentoParada'];
 $Distancia         = $_POST['Distancia'];
 $email             = $_POST['email'];
 $Entrega           = $_POST['Entrega'];
 $horario           = $_POST['horario'];
 $Itinérario        = $_POST['Itinérario'];
 $Limpeza           = $_POST['Limpeza'];
 $Manutencao        = $_POST['Manutencao'];
 $phone             = $_POST['phone'];
 $tCobrador         = $_POST['tCobrador'];
 $Tratamento        = $_POST['Tratamento'];
 $email             = $_POST['email'];
 $phone             = $_POST['phone'];
 $erro = 0;

Inserting all variables in the database

$insereDados = mysql_query("INSERT INTO respostas(Cobranca,Conducao,conforto,Conservacao,CumprimentoParada)VALUES('$Cobranca','$Conducao','$conforto','$Conservacao')");
    
asked by anonymous 01.06.2016 / 23:25

1 answer

1

First problem I detected:
Your mysql_connect parameters are not correct. You have:

$conn = mysql_connect($servidor,$user,$pass,$banco);

Although deprecated mysql_connect is only given 3 input parameters,

Server - In your case $ server
User - In your case $ user
Password Optional ) - In your case $ pass

In your mysql_select_db you will select your database and then check whether it exists or not.

mysql_select_db($banco)
if (!$banco){
   echo "Ocorreu um erro";
}

Or you can just use mysql_error () .

Finally, your query is missing you calling your $ conn at the end of INSERT

Note: Read about mysqli. The mysql function is outdated as Michael said. Using this function can create serious security holes in the systems you can develop.

    
02.06.2016 / 12:03