I try to count the amount of invoices in the database:
//conexion:
$con=@mysqli_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME);
if(!$con){
die("imposible conectarse: ".mysqli_error($con));
}
if (@mysqli_connect_errno()) {
die("Conexión falló: ".mysqli_connect_errno()." : ". mysqli_connect_error());
}
// Connection in this file:
require_once ("config/db.php");//Contiene las variables de configuracion para conectar a la base de datos
require_once ("config/conexion.php");//Contiene funcion que conecta a la base de datos
$query = "SELECT COUNT(*) AS total FROM 'facturas'";
if ($result) {
$result = mysqli_query($con, query);
$row = mysqli_fetch_array('MYSQLI_ASSOC');
echo $row['total'];
} else {
echo "Sin datos que mostrar";
}
The case that comes out of the if and tells me "no data to show".