Help me sir for this error, Connect Error (2002) No connection could be made because the target machine actively refused it.

my connection
//my database class

class Db {
    // make sure we dont connnect database to every function
    public $mysql;
    function __construct(){
        $this->mysql = new mysqli('10.100.2.234','sa','P@ssw0rd','PLAZATOYOTA_MSCRM');
        if (mysqli_connect_error()) {
            die('Connect Error (' . mysqli_connect_errno() . ') '
                    . mysqli_connect_error());
        }
    }
}
$db = new DB();
var_dump($db->mysql);

my code :

  $db = new Db();
                  $query = "SELECT * from account";
                  $results = $db->mysql->query($query);
                  if($results->num_rows){
                      while($row = $results->fetch_object()) {
                          // $title = $row->title;
                          // $description = $row->description;
                          // $id = $row->id;

                        print_r($row);

                          //the rest of the code go here...
                      }
                  }





 i want make json but i can't , because that error in my xampp.

 Thanks

Generally that error is not due to your code. Either the firewall is blocking you or the database is listening on a specific port.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.