undefined变量:mysqli-ungaught error:调用成员函数查询

I'm creating a simple PHP/MySQL app to select, insert, delete data.

The intial code is:

  <?php
    //create the select query
    $query="SELECT * FROM customers
    INNER JOIN customer_addresses
    ON customer_addresses.customer=customer.id";

   //GET results
    $result=$mysqli->query($query) or die($mysqli->error.__LINE__);
     ?>

I obtain this error:

Notice: Undefined variable: mysqli in C:\xampp\htdocs\cmanager\index.php on line 11

Fatal error: Uncaught Error: Call to a member function query() on null in C:\xampp\htdocs\cmanager\index.php:11 Stack trace: #0 {main} thrown in C:\xampp\htdocs\cmanager\index.php on line 11

understand why... I have installed the last version of XAMPP on windows 10.

The 11 line is the last of the code that I posted.

You are trying to access a variable which wasn't declared.

Try,

<?php
$mysqli = new mysqli($servername, $username, $password, $dbname);
//create the select query
    $query="SELECT * FROM customers
    INNER JOIN customer_addresses
    ON customer_addresses.customer=customer.id";

   //GET results
    $result=$mysqli->query($query) or die($mysqli->error.__LINE__);