chuva Posted January 28 Share Posted January 28 (edited) 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 January 28 by chuva 0 Quote Link to comment Share on other sites More sharing options...
Solution pRieStaKos Posted January 30 Solution Share Posted January 30 Check an email if it contains "value=". Or your check will fall to else. Query is OK. You message content you need to check. 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.