 	<?php
    // Connect to the database (replace with your database credentials)
    $db = new mysqli('localhost', "tslibrary_user", "rb!tsl838", "tslibrary_data");

    if ($db->connect_error) {
        die("Connection failed: " . $db->connect_error);
    }

    // Query to select records from the book_allot_receive table
    $sql = "SELECT * FROM books ";
    $result = $db->query($sql);

    if ($result->num_rows > 0) {
$j=0;
        while ($row = $result->fetch_assoc()) {
		          
        $j=$j+1;    
           		
        }
      
    } else {
        
    }

    $db->close();
    ?>
            <div class="col-xxl-4 col-md-6">
              <div class="card info-card revenue-card">

                <div class="filter">
                  <a class="icon" href="#" data-bs-toggle="dropdown"><i class="bi bi-three-dots"></i></a>
                  <ul class="dropdown-menu dropdown-menu-end dropdown-menu-arrow">
                    <li class="dropdown-header text-start">
                      <h6>Filter</h6>
                    </li>

                    <li><a class="dropdown-item" href="#">Today</a></li>
                    <li><a class="dropdown-item" href="#">This Month</a></li>
                    <li><a class="dropdown-item" href="#">This Year</a></li>
                  </ul>
                </div>

                <div class="card-body">
                  <h5 class="card-title">Total Books<span>| Library</span></h5>

                  <div class="d-flex align-items-center">
                    <div class="card-icon rounded-circle d-flex align-items-center justify-content-center">
                      <i class="fa fa-inr"></i>
                    </div>
                    <div class="ps-3">
                      <h6><?php echo $j ?></h6>
                      <span class="text-success small pt-1 fw-bold">  </span> <span class="text-muted small pt-2 ps-1">increase</span>

                    </div>
                  </div>
                </div>

              </div>
            </div><!-- End Revenue Card -->