0
I have the following resolution, I am not able to register in the bank. I already changed some things but always appears these errors:
Warning: mysqli_set_charset() expects parameter 1 to be mysqli, resource given in C:\xampp\htdocs\envio\conecta_mysql.inc on line 5
Notice: Trying to get property of non-object in C:\xampp\htdocs\envio\conecta_mysql.inc on line 7
Fatal error: Call to a member function query() on resource in C:\xampp\htdocs\envio\insere.inc on line 17
This is the conecta_mysql.inc:
<?php
$conexao = mysql_connect('localhost', 'root', '', 'formulario');
mysqli_set_charset($conexao, 'utf8');
if ($conexao->connect_error) {
die("Falha ao realizar a conexão: " . $conexao->connect_error);
}
?>
This is the inserts.inc:
<?php
include 'conecta_mysql.inc';
$n_1 = $_POST['n_1'];
$n_2 = $_POST['n_2'];
$n_3 = $_POST['n_3'];
$consultor01 = $_POST['consultor01'];
$consultor02 = $_POST['consultor02'];
$consultor03 = $_POST['consultor03'];
$total_acordos = $_POST['total_acordos'];
$total_parcelas = $_POST['total_parcelas'];
$sql = "INSERT INTO n_acordos VALUES";
$sql .= "('$n_1','$n_2','$n_3','$consultor01','$consultor02','$consultor03','$total_acordos','$total_parcelas')";
if ($conexao->query($sql) === TRUE) {
echo "Informações atualizadas com sucesso!";
} else {
echo "erro: " . $sql . "<br>" . $conexao->error;
}
$conexao->close();
?>
I was able to fix the connection only if it shows error in the other file--> inserts.inc line 17 --> if ($connectionwith->query($sql) === TRUE) { echo "Updated information successfully!";
– Cassio Bruno
What is the error message?
– Neto Costa
Notice: Undefined variable: connection in C: xampp htdocs send inserts.inc on line 17 Fatal error: Call to a Member Function query() on null in C: xampp htdocs send inserts.inc on line 17
– Cassio Bruno
A doubt the file extensions are ". inc"?
– Neto Costa