I was using following php code to check number of MySQL connections
$connection=mysql_connect("localhost","$mysql_user","$mysql_pwd");
if (mysqli_connect_errno())
{ echo "NO CONNECTION"; }
else
{
unset ($result);
$result = mysql_list_processes($connection);
while ($row = mysql_fetch_assoc($result)){
$mysql_data[]=$row["db"];
}
mysql_free_result($result);
$n_connections=count($mysql_data)-1;
}
echo "$n_connections";
Since mysql_connect was deprecated in PHP 5.5.0, I changed $connection with
$connection=mysqli_connect("localhost","$mysql_user","$mysql_pwd", "$mysql_db");
After doing this change, $n_connections is no more returning the correct value , what is wrong in the code please ?
Thank you
note : function mysqli_list_processes in php.net does not help, I tried it and it does not work.
note 2: this post is not a duplicate of "How to change mysql to mysqli?" , my problem is replacing "$result = mysql_list_processes($connection);"