<?php // Define the current date $current_date = strtotime('02-04-2024'); // Current Unix timestamp for the example // Define the From date and To date from Table 1 $from_date_table1 = strtotime('20-03-2024'); $to_date_table1 = strtotime('30-05-2024'); // If To date is greater than current date, set it to current date if ($to_date_table1 > $current_date) { $to_date_table1 = $current_date; } // Calculate the total days between From date and adjusted To date $total_days = floor(($to_date_table1 - $from_date_table1) / (60 * 60 * 24)) + 1; // Add 1 to include both From date and To date // Output the total days echo "Total days between From date and adjusted To date: " . $total_days . " days.\n"; ?>
Posts
- Get link
- Other Apps
SELECT CASE WHEN type = 'allocated' THEN car_no ELSE (SELECT car_no FROM tbl_booked_car_details b2 WHERE b2.tbl_booking_details_primary_id = bd.tbl_booking_details_primary_id AND b2.type = 'allocated' ORDER BY allocation_from_date DESC LIMIT 1) END AS car_no, car_no as served_car, allocation_from_date, allocation_to_date FROM tbl_booked_car_details bd ORDER BY car_no, allocation_from_date;
ddd
- Get link
- Other Apps
SELECT t1.car_no, SUM(DATEDIFF(FROM_UNIXTIME(t1.allocation_to_date), FROM_UNIXTIME(t1.allocation_from_date)) + 1) AS total_days_booked, SUM( CASE WHEN t2.allocation_to_date IS NOT NULL THEN DATEDIFF(FROM_UNIXTIME(t1.allocation_from_date), FROM_UNIXTIME(t2.allocation_to_date)) - 1 ELSE 0 END ) AS missing_days FROM tbl_booked_car_details t1 LEFT JOIN tbl_booked_car_details t2 ON t1.car_no = t2.car_no AND FROM_UNIXTIME(t1.allocation_from_date) > FROM_UNIXTIME(t2.allocation_to_date) GROUP BY t1.car_no;
query
- Get link
- Other Apps
SELECT d .aggregator_id , d .model_id , CASE WHEN COUNT ( r .tbl_demo_p_id ) = d .quantity THEN 'Full' ELSE 'Empty' END AS status FROM tbl_demo d LEFT JOIN tbl_demo_refer r ON d .id = r .tbl_demo_p_id WHERE d .aggregator_id = 1 AND d .model_id = 2 GROUP BY d .aggregator_id , d .model_id , d .quantity ; SELECT d.aggregator_id, d.model_id, CASE WHEN COUNT(r.tbl_demo_p_id) = d.quantity THEN 'Full' ELSE 'Empty' END AS status FROM tbl_demo d LEFT JOIN tbl_demo_refer r ON d.id = r.tbl_demo_p_id WHERE d.aggregator_id = <aggregator_id_value> AND d.model_id = <model_id_value> AND r.car_no = '<car_no_value>' GROUP BY d.aggregator_id, d.model_id, d.quantity;
- Get link
- Other Apps
index.php <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Dynamic Page Loading with Login, Active Page, and Completed Pages</title> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css"> <script src="https://code.jquery.com/jquery-3.6.4.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script> <style> #content-container { margin: 10px; padding: 10px; border: 1px solid #ddd; } #page-list { list-style: none; padding: 0; } #page-list li { margin-bottom: 5px; cursor: pointer; } #page-list li.active { background-color: #007bff; color: #fff;
Select one checkbox at a time from group of checkbox
- Get link
- Other Apps
Select one checkbox at a time from group of checkbox <div class="btn-group" role="group" onclick="selectOne(event)"> <input type="checkbox" class="btn-check" id="btncheck1" value='1' autocomplete="off"> <label class="btn btn-outline-primary" for="btncheck1">Checkbox 1</label> <input type="checkbox" class="btn-check" id="btncheck2" value='2' autocomplete="off"> <label class="btn btn-outline-primary" for="btncheck2">Checkbox 2</label> <input type="checkbox" class="btn-check" id="btncheck3" value='2' autocomplete="off"> <label class="btn btn-outline-primary" for="btncheck3">Checkbox 3</label> </div> <script> function selectOne(event) { const clickedElement = event.target;
Form Validation
- Get link
- Other Apps
Form Validation <!DOCTYPE html> <html> <head> <title>Form Validation</title> </head> <body> <form id="loginForm"> <input type="text" name="username" required placeholder="Username" data-error-msg="Username is required"><br><br> <input type="password" name="password" required placeholder="Password" data-error-msg="Password is required"><br><br> <input type='text' class='form-control' data-error-msg="Data required" required> <!-- Additional form fields --> <button type="button" id="submitForm">Submit</button> </form> <div id="result"></div> </body> <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> <script>