Pull All Records from 'clients' Table in Database

RECORDS
ID Name Address 1 Address 2 City State Zip Phone
2 Lavaysse Circus 27 Woodland Avenue San Mateo CA 94402 (211) 107-2844
21 Sherwood Oaks 1941 aberdeen way Davis CA 95616 (143) 275-2569
25 Easter Travel 4114 W. Elm Suite 370 Stratham CA 03885 (330) 871-5564
26 Richman Buick PO BOX 4971 Boulder CA 80302 (131) 664-3716
27 Daly Autobody 4388 Folsom Street Suite 673 Santa Clara CA 95050 (642) 915-9286
 

CODE FOLLOWS

<?php

// set error reporting to all
error_reporting(E_ALL);
include(
'includes/header.php');

// declare connection variable that is populated by the open-db file
$con '';

?>
<h1>Pull All Records from 'clients' Table in Database</h1>
<!-- start of table -->
<table class="full">
    <tr>
        <th colspan=8 class="header1">
            RECORDS
        </th>
    </tr>
    <tr class="header2">
        <th>ID</th>
        <th>Name</th>
        <th>Address 1</th>
        <th>Address 2</th>
        <th>City</th>
        <th>State</th>
        <th>Zip</th>
        <th>Phone</th>
    </tr>

    <?php

    
// get records from the 'clients' table from the database
    // open db without exposing credentials
    
include('includes/open-db.php');

    
// SQL for selecting all records from the clients table where the state is California
    
$query "SELECT * FROM clients WHERE state = 'CA' ";
    
$result mysqli_query($con$query) or die("Could not get data: $query " mysqli_error());

    
// get and display records
    
$i 0;
    while (
$row mysqli_fetch_array($result))
    {
        
$id $row['id'];
        
$name $row['name'];
        
$address_1 $row['address_1'];
        
$address_2 $row['address_2'];
        
$city $row['city'];
        
$state $row['state'];
        
$zip $row['zip'];
        
$phone $row['phone'];
        
?>

        <tr class="row<?php echo($i++ & 1); ?>">
            <td>
                <?php echo($id); ?>
            </td>
            <td>
                <?php echo($name); ?>
            </td>
            <td>
                <?php echo($address_1); ?>
            </td>
            <td>
                <?php echo($address_2); ?>
            </td>
            <td>
                <?php echo($city); ?>
            </td>
            <td>
                <?php echo($state); ?>
            </td>
            <td>
                <?php echo($zip); ?>
            </td>
            <td>
                <?php echo($phone); ?>
            </td>
        </tr>

        <?php
    
}

    
// close db
    
include('includes/close-db.php');
    
?>

</table>
<!-- end of table -->
<!--<hr>-->

<?php

include('includes/footer.php');

?>