I have 2 tables lc_details and reference, and those have reference_no columns. I want to compare those tables and select reference_no from the reference table if lc_details.reference_no does not exist in reference.reference_no column.
Here is my code but it shows all data from reference table and repeat more times.
        <table class="table table-striped">
        <tr>
            <th>Sl. No.</th>
            <th>Reference No./th>
        </tr>
        <?php
        include("../db/db.php");
        $sql_cat="select b.* from lc_details a, reference b where b.reference_no!=a.reference_no' order by reference_no ASC";
        $run_sql=mysqli_query($con, $sql_cat);
        $i=0;
        while($row_cat=mysqli_fetch_array($run_sql)){
            $reference_no=$row_cat['reference_no'];
            $i++;
        ?>
        <tr align="center">
            <td><?php echo $i; ?></td>
            <td><?php echo $reference_no; ?></td>
           </tr>
           <?php } ?>
        </table>
 
     
     
    