Jump to content

I need to filter a query on the 'message' table.


chuva
Go to solution Solved by pRieStaKos,

Recommended Posts

Hello Friends,

I am creating a hook that should retrieve information from the 'message' column of the 'tblemails' table.

In the 'message' column, there is a large amount of information that I am not interested in, so I created a filter (with the help of ChatGPT). It works, but interestingly, it doesn't filter out some things.

Is there a more efficient way to create a filter?

Here is the code I am using:

// msg content
$email_query = Capsule::table('tblemails')
    ->where('userid', $userid)
    ->where('subject', 'like', '%' . $invoice_id . '%')
    ->orderBy('id', 'desc')
    ->value('message');

// filter
if (preg_match('/value="([^"]*)"/i', $email_query, $matches)) {
    // $matches[1] conterá o conteúdo dentro das aspas duplas após "data-pix="
    $msgtest = htmlspecialchars($matches[1], ENT_QUOTES, 'UTF-8');
    echo $msgtest;
} else {
    // msg error
}

 

Edited by chuva
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated