0

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
2
Contributors
1
Reply
6
Views
1 Year
Discussion Span
Last Post by hericles
0

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.