无法计算数据库用户

I can't count my users in the database with my current configurations.

<?php
require_once 'scripts/app_config.php';
mysqli_connect(DATABASE_HOST,DATABASE_USER,DATABASE_PASS,DATABASE_NAME);
// Check connection
if (mysqli_connect_errno())
  {
  echo "Failed to connect to MySQL: " . mysqli_connect_error();
  }
$query = "SELECT COUNT(*) FROM users";
$result = mysql_query($query);
$num = mysql_num_rows($result);
echo "There are: ". $num . " users in the database";
mysqli_close($con);
?>

Your problem is this:

$num = mysql_num_rows($result);

Your query only returns 1 row, so I presume the problem you're having is that it always outputs: There are 1 users in the database.

You should instead use:

$num = mysqli_fetch_array($query)[0];

Either use COUNT(*) OR use mysql_num_rows

$query = "SELECT COUNT(*) FROM users";
$result = mysql_query($query);
$row = mysql_fetch_array($result);

$num = $row[0];

echo "There are: ". $num . " users in the database";


Note : mysql_* function is deprecated, move on mysqli_* function asap.