I would like to resolve a data connection problem in navcat. I can not send the data to the database and I do not know what I'm doing wrong, if anyone can give me some suggestions, the connection is mysql .
config.php:
<?php
$config = array(
'title' => 'Via Toscana',
'test' => 1, /* 1 em testes 0 em produção. */
'errors' => 1,
'rewrite' => 0
);
if($config['test'] == 1) {
$config['db_host'] = 'dev';
$config['db_base'] = 'via';
$config['db_user'] = 'via';
$config['db_pass'] = 'abc123';
}else{
$config['db_host'] = 'dev';
$config['db_base'] = 'via';
$config['db_user'] = 'via';
$config['db_pass'] = 'abc123';
}
class objConexao {
private $objConn;
public function __construct() {
global $config;
$this->objConn = mysql_connect($config['db_host'], $config['db_user'], $config['db_pass']) or trigger_error(mysql_error(), E_USER_ERROR);
$link = mysql_select_db($config['db_base'], $this->objConn);
}
public function __destruct() {
@mysql_free_result();
@mysql_close();
}
public function fcnConn(){
return $this->objConn;
}
}
$objConn = new objConexao();
$conn = $objConn->fcnConn();
?>
Form:
About < / option> - > Cart & amp; amp; amp; Money Your username is logging in and can not be changed.
-> </div>
<ul class="row">
<li class="col-sm-12">
<label>
<input type="text" class="form-control" name="nome" id="nome" placeholder="Nome *" />
</label>
</li>
<li class="col-sm-6">
<label>
<input type="text" class="form-control" name="email" id="email" placeholder="E-mail *" />
</label>
</li>
<li class="col-sm-6">
<label>
<input type="text" class="form-control" name="telefone" id="telefone" placeholder="Telefone *" />
</label>
</li>
<li class="col-sm-12">
<label>
<textarea class="form-control" name="mensagem" id="mensagem" rows="5" placeholder="Mensagem *"></textarea>
</label>
</li>
</ul>
<div class="col-sm-12 text-center">
<input type="submit" id="bt-confirmar" class="btn btn-default btn-round" value="CONFIRMAR" name="confirmar"/>
</div>
</form>
envia.php:
<?php
$nome = $_POST['cliente_nome'];
$telefone = $_POST['cliente_telefone'];
$email = $_POST['cliente_email'];
$bairro = $_POST['cliente_bairro'];
$rua = $_POST['cliente_rua'];
$complemento = $_POST['cliente_complemento'];
$sql = "INSERT INTO cliente VALUES ";
$sql .= "('$nome', '$telefone', '$email','$bairro','$rua','$complemento')";
echo $sql;exit();
mysql_query($sql,$objConn) or die(mysql_error());
mysql_close($objConn);
echo "Cliente cadastrado com sucesso!";
?>
Bank: