WP_Query comparing current date to custom meta date not working – WordPress PHP

I have custom post type, and there I have custom meta key called pickup_datetime. I am comparing the current date to the pickup date, but it’s not working. I mean, it doesn’t show the posts when I compare the dates in WP_Query .
What i wanna compare: Display those posts whose pickup datetime is larger than current date, if pickup datetime is less than current date then don’t display the posts.
Here are the dates, I am printing the pickup_datetime of a post:
enter image description here
You can see that pickup_datetime is larger date than current date, but it doesn’t display the posts.
Here are my code:

function getTodayDate() {
    $parisTime = new DateTime("now", new DateTimeZone('CEST'));
    return $parisTime->format('F d, Y H:i A');
}

$bookings = new WP_Query([
    'post_type' => 'chbs_booking',
    'status' => 'publish',
    'meta_query' => array(
        array(
          'key' => 'chbs_booking_status_id',
          'value' => 4
        ),
        array(
          'key' => 'chbs_driver_id',
          'value' => -1,
        ),
        array(
          'key' => 'chbs_pickup_datetime',
          'value' => getTodayDate(),
          'compare' => '>=',
          'type' => 'DATE'
        ),
    )
]);

echo "Now:";
print_r(getTodayDate());

echo "Pickup Time:";
print_r(date('F d, Y, H:i A', strtotime(get_post_meta(12234, 'chbs_pickup_datetime', true))));

echo "Bookings: ". count($bookings->posts);

Can someone please help me? I am stuck.

JSON data not loading in C# after JavaScript rendering in but works fine in Datagrid view

I am trying to load data from the server in DataGrid view but after the rendering from JSON in JavaScript my data does not load. I can display and export the records in flat file but the same report display the message that Index was out of the array, bound problem.

My data is complete loaded from the server and there is no issue in the C#.NET application but only some parameter or values are having a problem after rendering JSON template and from PHP function. I have searched several places for the problems and included the DLL file for sockets but still having the same issue.

The error is: Index was out of the range.
(It’s urgent)

How to take the minimum numbers from an array PHP

I have a problem with retrieving numbers from an array,
For e.g, I will have an array like this

[20, 25, 40, 50, 30, 45, 33, 25]

I would like to retrieve the first 3 minimum numbers from the array.
Neither too big nor too small and not to be duplicated
For e.g ouput will be

[20, 25, 33]

refresh variable every second in a laravel balde template file that refresh part of the page

I’m using laravel 9 and i’m new to using the blade template view files.

I have an blade template file that shows a table and has some buttons to interact with that.

the table is just a result of select * from some_table, and i want it to be refreshed every second, i tried to google.. found broadcasting.. ajax… everything seems a bit too complicated for a simple task as this.

so I have a route at web.php

Route::get('/test-page', function () {
    return view('test-page');
});

and test-page.blade.php contains:

<?php
  $agents = IlluminateSupportFacadesDB::select('select * from agents');
?>
<!DOCTYPE html>
<html>
...
<table>
...
  <tbody>
     @foreach ($agents as $agent)
       <tr>
        <td>{{ $agent->id }}</td>
        <td> {{ $agent->name }}</td>
...
       </tr>
     @endforeach

i want $agents variable to be refreshed every second, and the table display would changed accordantly without refreshing the all page. there must be a simple way to do just that.

i guess i can create a route that will return that data in a json format and return it, i’m sure there is a cool laravel way to resolve this just don’t know how or where to start really.

any information regarding this issue would be greatly appreciated.

How do I pass double array as perimeter into php curl [duplicate]

Am new here want to achieve this
As php curl post
To endpoint whapi.io/send

Example sending a text
{
“app”: {
“id”: “6812345xxx”,
“time”: “1659260756”,
“data”: {
“recipient”: {
“id”: “68213652xxx”
},
“message”: [
{
“time”: “1659260756”,
“type”: “text”,
“value”: “Hello World!”
}
]
}
}
}

Use Laravel traditional form fields with the Livewire field component

I want form fields data along with livewire fields data in my request.
Suppose I have a basic html form along with a livewire component.

create.blade.php

<form>
<input type = 'text' name='name' placeholder = 'name' />
<input type = 'text' name='rollno' placeholder = 'rollno' />
..... //some more input fields
  @livewire('system.search-users')
<button type='submit'>Save</button>
</form>

search-users.blade.php

<div>
    <input
        type="text" id="user" name="q" wire:model="search" placeholder="Search Users" autocomplete="off" />
    <select multiple
        id="users">
        @foreach ($users as $user)
            <option value="{{ $user->id }}" wire:click="selectedUserHandler({{ $user->id }})">
                {{ $user->name }} @if (in_array($user->id, $selectedUsers))✔@endif
            </option>
        @endforeach
    </select>
     // I have done this solution and am searching for a better solution.
    @foreach ($selectedUsers as $user)
        <input type="hidden" name="users[]" value="{{ $user }}" />
    @endforeach
   
</div>

When submitting a form from create.blade.php, how can I get the selected user_ids in the request? I have already solved this but am not sure if it is the right way or not.

Multiple execution of a pop-up made in php and jquery

I have a code to display a pop. The problem with this code is that it is executed several times if I want it to be executed only once.
This pop-up is for the user to click on their country and change its currency.
But when the pop-up comes up and we set the country, the page is refreshed again and the same pop-up appears.
Do you have a solution to fix this problem?
My code example:

    if(!isset($_COOKIE[$isfirstsee])) {
        global $WOOCS;
        $WOOCS->set_currency('GBP');
        $isfirstsee = "isfirstsee";
        $cookie_value = "no";
        setcookie($isfirstsee, $cookie_value, time() + (86400 * 30), "/"); // 86400 = 1 day
        //echo "tttt1";
        
        echo '<script>
                jQuery(function($){
                    $(".modal-dialog_swicher_shipping_parsa #billing_country").prepend($("<option>", {
                        value: 0,
                        text: "Choose the delivery location"
                    }));
                    $(".modal-dialog_swicher_shipping_parsa #billing_country  option[value=0]").attr('selected',true);
                    $("a.shipToLink.clickaction").click();
                });
        </script>';
    }
    echo '<script>
            jQuery(function($){
                $(".modal-dialog_swicher_shipping_parsa #billing_country").prepend($("<option>", {
                        value: "all",
                        text: "All Countries"
                    }));
                $(".modal-dialog_swicher_shipping_parsa #billing_country").prepend($("<option>", {
                        value: "DE",
                        text: "Germany"
                    }));
                $(".modal-dialog_swicher_shipping_parsa #billing_country").prepend($("<option>", {
                        value: "NL",
                        text: "Netherlands"
                    }));
                $(".modal-dialog_swicher_shipping_parsa #billing_country").prepend($("<option>", {
                        value: "CA",
                        text: "Canada"
                    }));
                $(".modal-dialog_swicher_shipping_parsa #billing_country").prepend($("<option>", {
                        value: "GB",
                        text: "United Kingdom (UK)"
                    }));
                $(".modal-dialog_swicher_shipping_parsa #billing_country").prepend($("<option>", {
                        value: "US",
                        text: "United States (US)"
                    }));
                $(".modal-dialog_swicher_shipping_parsa #billing_country").prepend($("<option>", {
                        value: "my",
                        text: "My Top 5 Countries"
                    }));                
            });
    </script>';
    //global $WOOCS;
    //$WOOCS->set_currency('GBP');
    error_reporting(0);
}

Thanks

Docker-php-ext-install vs apt install?

I’m trying to install pdo-mysql to PHP container
I tried to install it using command line as:

    apt install pdo pdo_mysql

but the extension not installed and provide a lot of errors.

But When I use

docker-php-ext-install pdo pdo_mysql

The extension was installed successfully

So what is the difference between them, and when must just each of them.

Call Variable From Function In PHP [duplicate]

Hello Guys I Have This Fucntion

function Say_Hello () {
      $Hello  = 'Hi';
}

return $Hello; // Undefiend $Hello Variable 

And I Want To Call Hello Variable Outside The Function But I Have This Error

Undefiend $Hello Variable

Can Any One Help Me Please?

i want to send data form my Esp8266 to an API PHP webside and then i got the error 400 from the Response Code

I’m trying to do a http request with my esp8266 and I get the Response code 400 from my ESP. Do you have an idea what is wrong with my code?

I used the Code from this Webside:
https://randomnerdtutorials.com/esp32-esp8266-mysql-database-php/

The Website is hosted by Strato

C code:

#include <ESP8266HTTPClient.h>
#include <WiFiClient.h>
#include <Wire.h>
#include <Adafruit_Sensor.h>

const char* ssid     = "----";
const char* password = "----";
const char* serverName = "----";
String apiKeyValue = "tPmAT5Ab3j7F9";

void setup() {

Serial.begin(115200);

  WiFi.begin(ssid, password);
  while(WiFi.status() != WL_CONNECTED) { 
    delay(500);
  }
    Serial.println("");
  Serial.print("Connected to WiFi network with IP Address: ");
  Serial.println(WiFi.localIP());
}

void loop() {
   
if(WiFi.status()== WL_CONNECTED){
    WiFiClient client;
    HTTPClient http;
    
    http.begin(client, serverName);
    http.addHeader("Content-Type", "application/x-www-form-urlencoded");

    String httpRequestData = "api_key=" + apiKeyValue
                          + "&sensor=" + '1'
                          + "&location=" + '2' 
                          + "&value1=" + '3'
                          + "&value2=" + '4' + "";
  Serial.println(httpRequestData);
    int httpResponseCode = http.POST(httpRequestData);
        if (httpResponseCode>0) {
      Serial.print("HTTP Response code: ");

      Serial.println(httpResponseCode);
    }
    else {
      Serial.print("Error code: ");
      Serial.println(httpResponseCode);
    }
    
    http.end();
  }
  else {
  }
  
  delay(10000);
}

PHP code:

$servername = '----';

$dbname = '----';
$username = '----';
$password = '----';
$Zeit = 'date("YmdHis")';

$api_key_value = "tPmAT5Ab3j7F9";

$api_key= $sensor = $location = $value1 = $value2 = $value3 = "";

if ($_SERVER["REQUEST_METHOD"] === "POST") {

    $api_key = test_input($_POST["api_key"]);

    if($api_key == $api_key_value) {
        $sensor = test_input($_POST["sensor"]);
        $location = test_input($_POST["location"]);
        $value1 = test_input($_POST["value1"]);
        $value2 = test_input($_POST["value2"]);
        
        $conn = new mysqli($servername, $username, $password, $dbname);

        if ($conn->connect_error) {
            die("Connection failed: " . $conn->connect_error);
        } 
        
        $sql = "INSERT INTO geraet_1 (sensor,Ort,Temperatur,Luftfeuchtigkeit,Zeit)
        VALUES (
            '" . $sensor . "',
            '" . $location . "',
            '" . $value1 . "',
            '" . $value2 . "',
            '" . $Zeit . "')";
        
        if ($conn->query($sql) === TRUE) {
            echo "New record created successfully";
        } 
        else {
            echo "Error: " . $sql . "<br>" . $conn->error;
        }
    
        $conn->close();
    }
    else {
        echo "Wrong API Key provided.";
    }
}
else {
    echo "No data posted with HTTP POST.";
}

function test_input($data) {
    $data = trim($data);
    $data = stripslashes($data);
    $data = htmlspecialchars($data);
    return $data;
} 

and here is the output from my esp:

HTTP Response code: 400

api_key=tPmAT5Ab3j7F9&sensor=1&location=1&value1=2&value2=5

Who can translate these codes from PHP to c#?

Who can translate the following PHP code to c#? Thank you very much.

$data["session_id"] = $sessionId;
$data["file"] = curl_file_create($filename, mime_content_type($filename), "Hello world");
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_TIMEOUT, 90);
curl_setopt($ch, CURLOPT_SAFE_UPLOAD, 0);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 0);
$output = curl_exec($ch);
$httpInfo = curl_getinfo($ch);
curl_close($ch);
unset($ch);