PHP - Sunil
386 FOLLOWERS
Find Post on PHP.
PHP - Sunil
3w ago
<?php
// Sample data
$bookings = array(
array("car_no" => 1234, "surved_car" => 1234, "allocation_from_date" => "20-02-2024 10:00", "allocation_to_date" => "20-03-2024 12:00", "lease_start_date" => "20-02-2024", "lease_end_date" => "20-02-2025", "type" => "allocated"),
array("car_no" => 1234, "surved_car" => 3856, "allocation_from_date" => "28-03-2024 10:00", "allocation_to_date" => "27-04-2024 12:00", "lease_start_date" => "28-03-2024", "lease_end_date" => "28-03-2025", "type" => "replaced"),
array("c ..read more
PHP - Sunil
3w ago
<?php
// Sample data
$bookings = array(
array("car_no" => 1234, "surved_car" => 1234, "allocation_from_date" => "20-02-2024 10:00", "allocation_to_date" => "20-03-2024 12:00", "lease_start_date" => "20-02-2024", "lease_end_date" => "20-02-2025", "type" => "allocated"),
array("car_no" => 1234, "surved_car" => 3856, "allocation_from_date" => "28-03-2024 10:00", "allocation_to_date" => "27-04-2024 12:00", "lease_start_date" => "28-03-2024", "lease_end_date" => "28-03-2025", "type" => "replaced"),
array("c ..read more
PHP - Sunil
3w ago
<?php
// Database connection parameters
$servername = "localhost";
$username = "username";
$password = "password";
$database = "your_database";
// Create connection
$conn = new mysqli($servername, $username, $password, $database);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
// Select all records from tbl_booking_details
$sql = "SELECT tbl_booking_details_primary_id, actual_end_date FROM tbl_booking_details";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// Loop through ..read more
PHP - Sunil
3w ago
<?php
function getTotalDays($from_date, $to_date) {
// Define the current date
$current_date = time(); // Current Unix timestamp
// Convert provided dates to Unix timestamps
$from_date_timestamp = strtotime($from_date);
$to_date_timestamp = strtotime($to_date);
// If To date is greater than current date, set it to current date
if ($to_date_timestamp > $current_date) {
$to_date_timestamp = $current_date;
}
// Calculate the tota ..read more
PHP - Sunil
3w ago
<?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 Fro ..read more
PHP - Sunil
3w ago
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_bo ..read more
PHP - Sunil
3w ago
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
  ..read more
PHP - Sunil
1M ago
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
&n ..read more
PHP - Sunil
3M ago
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 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> ..read more
PHP - Sunil
3M ago
Select one checkbox at a time from group of checkbox
<div role="group" onclick="selectOne(event)">
<input type="checkbox" id="btncheck1" value='1' autocomplete="off">
<label for="btncheck1">Checkbox 1</label>
<input type="checkbox" id="btncheck2" value='2' autocomplete="off">
<label for="btncheck2">Checkbox 2</label>
<input type="checkbox" id="btncheck3" value='2' autocomplete="off">
<label for="btncheck3">Checkbox 3</label>
</div>
<script>
function selectOne(event) {
&nbs ..read more