I have a simple problem with INSERT
on PHP
with MYSQL
, it happens that it does not insert anything in the database, I already put it to report the errors but it does not work, I'm using vertrigo server
The code is this:
<?php
include '../config/config.inc.php';
ini_set('display_errors',1);
ini_set('display_startup_erros',1);
error_reporting(E_ALL);
//$usuario = $_POST['fu_usuario'];
//$senha = $_POST['fu_senha'];
//$email = $_POST['fu_email'];
$sql = "INSERT INTO tb_cadastro (username,senha,email) VALUES ('teste','123','[email protected]')" ;
$res = mysqli_query($con,$sql) or die (mysql_error());
$num = mysqli_affected_rows($con);
if($num > 0){
echo "Usuario cadastrado com sucesso";
}else{
echo "Usuario não cadastrado";
}
mysqli_close($con);
?>
Connection code:
<?php
$con = mysqli_connect("localhost","root","vertrigo") or die
("Erro de conexao ao BD --> ". mysql_error());
mysqli_select_db($con,"dbsistema") or die("Erro de selecao do bd ". mysql_error());
?>