Error executing mysqli_query () on BD Select [duplicate]

0

When I am going to register something in the database of this

PHPcode

<?php
session_start();
include_once("../seguranca.php");
include_once("../conexao.php");
$nome_nivel 				= $_POST["nome_nivel"];

$query = mysqli_query("INSERT INTO nivel_acessos (nome_nivel, created) VALUES ('$nome_nivel', NOW())");
?>

Connection

<?php
	$servidor = "localhost";
	$usuario = "root";
	$senha = "";
	$dbname = "tcc";
	
	//Criar a conexao
	$conn = mysqli_connect($servidor, $usuario, $senha, $dbname);
    
asked by anonymous 03.11.2017 / 10:59

1 answer

1

You need to connect to mysqli_query:

$query = mysqli_query($conn,"INSERT INTO nivel_acessos (nome_nivel, created) VALUES ('$nome_nivel', NOW())");

Syntax:

mysqli_query($conn,"query");

link

    
03.11.2017 / 11:05