problem with delete record by mvc and ajax [closed]

i want to delete record by ajax and mvc in php
record deleting correctly work but no remove row element in page
what is problem?
homePage Code:
delete btn in last column:

<td><span class="link" onclick="deleteNote(this,<?= $row['noteID'] ?>)"> <i class="bi bi-calendar-x"></i></span></td>

home page script:

<script>
    function deleteNote(sender, noteId) {
        sender = $(sender);
        var parent = sender.parentsUntil('tr').parent();
        $.ajax('/notes3-uncox-withMVCandAJAX/notes/remove/' + noteId, {
            type: 'post',
            dataType: 'json',
            success: function(data) {
                console.log("SUCCESS Ok", data);
                parent.remove();
            }
        });
    }
</script>

modelCode:

<? class NoteModel
{
 public static  function delete($id)
    {
        $db = Db::getInstance();
        $db->modify("delete from x_note where noteID='$id'");
        // header("Location: " . getBaseUrl() . "page/home");
    }
}

controller Code:

<?
class NotesController
{
    public  function remove($params)
    {
        $id = $params[0];
        NoteModel::delete($id);

        $out = json_encode(array(
            'status' => true,
        ));
        echo $out;
    }
}

if i am uploading multiple only images into databse with single column then facing issue

I wanna store multiple images into database with single column show i was designed code but my code is not working properly actually image uploading successfully and also store database record in single column but not uploading local directory folder i want this image upload in database and also upload local directory folder

Note: i don’t want to store file type, size, etc.. i want only image

i have two field in database 1st one is id another is image

here is the my php code

    $R_Prop_Images =$_FILES["R_Prop_Images"]["name"]; 
    
    $location="../property_images/";
    $R_Prop_Images =implode(", ",$R_Prop_Images);
    if(!empty($R_Prop_Images)){
    foreach ($R_Prop_Images as $key => $val) {
        $targetPath=$location .$val;
        move_uploaded_file($_FILES["R_Prop_Images"]["tmp_name"][$key], $targetPath);
    }
}

here is the my html code

<span class="btn_upload">
<input type="file" id="imag" title="" name='R_Prop_Images[]' class="input-img" multiple />
<span>UPLOAD FILES</span>

Invalid object when call createOrGetStripeCustomer

When calling the createOrGetStripeCustomer() function in Cashier’s Stripe integration, I get an “Invalid object” error.

Here’s my Billable model:

/**
 * Get the customer address that should be synced to Stripe.
 */
public function stripeAddress(): string|null
{
    return $this->address_line1 . ' ' . $this->address_line2 . ' ' . $this->postal_code . ' ' . $this->country;
}

How to update MYSQL Table and delete duplicate record more than one each day same ID

I have Attendance Table, and import table.
Import Table as Below

ID date_time
1001 2023-08-15 8:00:00
1002 2023-08-15 8:01:00
1001 2023-08-15 19:31:00
1002 2023-08-15 19:35:00

I get these data and inserting into Attendance Table, EMPID, TimeIN, TimeOUT
using Min(date_time) and max(date_time) my attendance table like below

EMPID TimeIN TimeOUT
1001 2023-08-15 8:00:00 2023-08-15 19:31:00
1002 2023-08-15 8:01:00 2023-08-15 19:35:00

but in the middle of the day if i import data my attendance table like below

EMPID TimeIN TimeOUT
1001 2023-08-16 8:21:00 2023-08-15 08:21:00
1001 2023-08-16 20:01:00 2023-08-15 20:01:00

I need to update attendance table TimeIN 8:21:00 and TimeOUT 20:01:00 and delete 2nd row

I tried created temporary table (att_duplicate) using below code
INSERT INTO att_duplicate SELECT EMPID, min(TimeIN) as TimeIN, max(TimeOUT) as TimeOUT, SN from attendance GROUP by EMPID, date(TimeIN) HAVING COUNT(TimeIN)>1 ORDER BY EMPID, TimeIN;

then i update attendance table join with att_duplicate table using below code
UPDATE attendance att JOIN att_duplicate dup ON att.EMPID = dup.EMPID AND DATE(att.TimeIN)= date(dup.TimeIN) SET att.TimeOUT = dup.TimeOUT, att.TimeIN = dup.TimeIN

Then i delete attendance table duplicate records using below code, but this take very long time..
DELETE a1 FROM attendance a1 JOIN attendance a2 ON a1.EMPID = a2.EMPID AND a1.TimeIN = a2.TimeIN AND a1.SN > a2.SN;

Is this wrong method, is there any better and faster way

I need better and fastest way

Google pay / Phone pay transaction history read

For illustrative purposes, let’s consider the following scenario: I receive monthly payments of 1000 rs from approximately 500 users through Google Pay or Phone Pay. I am seeking guidance on how to extract dynamic transaction information such as the amount, phone number, and description, and subsequently integrate this data into my PHP website. The objective is to have a daily overview of incoming payments, including the sender’s details and pending transactions. Could you please advise if this is feasible?

Get campaign data from Google Display Video 360

I am trying to get data about campaigns from dv360 like clicks, impressions, views. What have I done is getting campaign list from API. I used ‘service account’ json file to authenticate and create client. But then I cannot find out any exampe in php, how to get data for specific campaign and range date.

$advertiserId = 'my_advertiser_id_xx';
$service = new Google_Service_DisplayVideo($this->getDv360Client()); 
$campaigns = $service->advertisers_campaigns->listAdvertisersCampaigns($advertiserId)->getCampaigns();

This short code list me campaings data like campaign ID for provided advertiser ID, but now, how can I get data like clicks, immpressions etc., for date range ‘2023-07-01’ – ‘2023-07-31’ by campaign ID I got from shown code? I cant find example in google documentation.

Include ‘target=”_blank”‘ inside a PHP/WordPress function?

I coded this custom widget for the admin-bar of a WordPress install i’m working on:

function custom_admin_bar_link_1($wp_admin_bar) {
$args = array(
    'id' => 'cal-cloudflare',
    'title' => 'Cloudflare', 
    'href' => 'https://dash.cloudflare.com/example.com/caching/configuration',
    'meta' => array(
        'class' => 'cal-cloudflare', 
        'title' => 'Clear Cloudflare Cache'
        )
);
$wp_admin_bar->add_node($args);
}
add_action('admin_bar_menu', 'custom_admin_bar_link_1', 999);

It works fine, but i want the link to open in a new windows when clicked. I tried this, but to no avail:

function custom_admin_bar_link_1($wp_admin_bar) {

$args = array(
    'id' => 'cal-cloudflare',
    'title' => 'Cloudflare', 
    'meta' => array(
        'class' => 'cal-cloudflare', 
        'title' => 'Clear Cloudflare Cache'
        ),
    'a' => array(
        'href' => 'https://dash.cloudflare.com/example.com/caching/configuration', 
        'target' => '_blank'
        )
);
$wp_admin_bar->add_node($args);
}
add_action('admin_bar_menu', 'custom_admin_bar_link_1', 999);

What needs to be done here?

Thanks.

How to send HTML content from one page to another

I am building a sort of job listing platform. When companies complete the input form specifying their needs, how can I use that input content in another page to display it on the job board?
A sort of document.querySelector(‘class’).innerHTML to select it from the other page, and display it.

Thanks in advance. I am learning JS to go through with some projects I have in mind.

I’ve seen people say I need PHP or something called JQuery. Is it possible to do it without? Or could someone point me to a course I could follow teaching specifically that?

Api Platform use Post to get data using an input

I’m working with Api Platform, Symfony and Doctrine. I’m expecting a JSON of an object from my frontend, which is essential in procuring the data from my backend. Since GET requests don’t/should not have a body, I believe a Post() Operation is the best way to achieve my goal. I have added an attribute to my entity, which resembles the following:

#[ORMEntity(repositoryClass: EntityRepository::class)]
#[ApiResource(
    operations: [
        new Get(security: "is_granted('ROLE_ADMIN') or is_granted('ROLE_USER')"),
        new Post(
            input: InputDto::class,
            provider: StateProvider::class,
            output: OutputDto::class,
            uriTemplate: 'entity/{variable}',
            uriVariables: ['variable' => 'variable'],
        )
    ]
)]

My state provider resembles the following example:

class StateProvider implements ProviderInterface
{
    public function __construct(
        private RequestStack $requestStack
    )
    {
        $this->requestStack = $requestStack;
    }

    public function provide(Operation $operation, array $uriVariables = [], array $context = []): object|array|null
    {
        $variable = $uriVariables['variable'] ?? null;
        
    // logic
        
        $outputDto = new OutputDto($dataProcuredFromLogic);

        return $outputDto;
    }
}

The logic seems to work just fine. If I add print_r($outputDto); just before the return statement, I get exactly the data I expected. But when executing the request, the response is just the exact same InputDto which I have sent through the body of the request, not the returned $outputDto of the provider.
This makes me wonder if what I’ve hoped to achieve is even possible.

I have tried to use a state processor instead of a provider and using the exact same logic. The only differences being that I did not need a RequestStack to get the input data, with it being in the parameters of the process() Method and me having to change the return type of the process() Method to my OutputDto. What I have gotten there was an error that looked like this:

"[Semantical Error] line 0, col 75 near 'property = :property_p1': Error: Class App\Entity\Entity has no field or association named property"

I am guessing in has something to do with Doctrine, because of ":property_p1" resembling what would seem like a parameter that was set on a QueryBuilder, but as I said, the logic, including my DQL Queries, seemed to work just fine when I printed my results using print_r().

I’m not sure if I should use a controller as I have read that they are discouraged in the Api Platform documentation.

Could you help me return the actual wanted output?

Thank you in advance for any help you can provide!

Connection could not be established with host ssl://smtp.mail.ru:465

Connection could not be established with host “ssl://smtp.mail.ru:465”: stream_socket_client(): Peer certificate CN=relay.v.fozzy.com' did not match expected CN=smtp.mail.ru’

my .env file

MAIL_MAILER=smtp
MAIL_HOST=smtp.mail.ru
MAIL_PORT=465
[email protected]
MAIL_PASSWORD=secret
MAIL_ENCRYPTION=ssl
[email protected]
MAIL_FROM_NAME="${APP_NAME}"

What can you help me do. Thank you.

NGINX- different web paths to different folders

I need to redirect different web paths to different folders on server.

http://test.local/site1/ => /srv/site_1/src/public
http://test.local/site2/ => /srv/site_2

tried such config, but it does not work

server {
    server_name test.local;
    root /srv;

    index index.html;

    location /site1/ {
        alias /srv/site_1/src/public;

        try_files $uri $uri/ /index.php?$args;

        fastcgi_pass unix:/var/run/php/php8.2-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
        include fastcgi_params;
    }

    location /site2/ {
        alias /srv/site_2;

        try_files $uri $uri/ /index.php?$args;

        fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
        include fastcgi_params;
    }
}

List of links for users based on button clicks in php

I’m not a very experienced programmer. I have build a user registration and login system and a webpage for concerts. I want my users to sign up for a concert and have that a list of links shown on their index page based on which concerts they’ve signed up for. I also want to give them the option to unsign from a concert.

So I have been reading up on it and it seems like I have to create a boolean for every concert and then have that be set to true on button click and then generate a list of all the true booleans for users; so that every user gets the list they’ve signed up for. I have no idea how to add booleans to mysql (I’ve created a DB in Phpmyadmin, then added a DB under that with users that now stores id, username, email and password)

I just can’t find an option to add those booleans and have no idea where to look. I also don’t know how to generate the list, I’m assuming it’s pretty simple, since it’s just the link to the webpage that they’ve clicked the button on, but I don’t really know where to look