I have the following code that should print me the amount of products registered in a table
<?php
require_once "js/conexion.php";
$sql = 'select count(idp) as total from producto';
$result = $mysqli->query($sql);
if(!$result){
die($mysqli->error);
}else {
$out = mysqli_fetch_array($result);
echo $out['total'];
}
$mysqli->close();
?>
At the moment of loading the page, you send me the following message
Commands out of sync; you can not run this command now
Try to run it in this other way
<?php
require_once "js/conexion.php";
$sql = 'select count(idp) as total from producto';
$result = $mysqli->query($sql);
if(!$result){
echo "Error ";
echo mysql_error();
die;
}else {
$out = mysqli_fetch_array($result);
echo $out['total'];
}
$mysqli->close();
?>
But send me this error
Fatal error: Uncaught Error: Call to undefined function mysql_error () in C: \ xampp \ htdocs \ point-sale \ Admin.php: 237 Stack trace: # 0 {main} thrown in C: \ xampp \ htdocs \ point-sale \ Admin.php on line 237