I have a column pack_size in a table called product_master_test. The problem that I am facing is that the pack_size is in mixed formats, there is no uniformity to it. For example: 4 x 2kg (pack …
Tag: php
How to fetch all the data in mssql having a multiple server name by using Php And MSSQL
I have module where I need to create a cron job in php, but first thing I need to do is to fetch all the data on the table on every each server name, so now the twist here is we have a lot of server …
PHP encode and decode text to ASCII characters
I plan to make a class that can encode files into ASCII characters and decode into readable texts. Basically, the idea of my encoding is to encode all non-space characters into ASCII and replace the …
Trying to get property of non-object in laravel 5.6
I get data from database: $user = DB::table(‘view_users’)->where([ ‘id’ => $friend->user_id, ‘type’ => $friend->…
Issues with directories and paths in a PHP project
I am having trouble figuring out this path problem. As you can see the highlighted tag is located in a file called admin_navigation.php and the href is going one directory up from includes folder …
call function url page with ajax
I have tried several times but it didn’t work. I want to call the function nama() on the dom_area.php page. This is dom_area as target
Filtering in Laravel using regex
I’m trying to filter products based on query string. My goal is to get products from a collection if it’s given, otherwise get every product. Could someone help me what’s wrong with the following code?…
Backslash in json_encode (PHP) + JSON_ARRAYAGG (mySQL)
The problem is the backslashes with the quotes in the array colors. I think it’s because the JSON_ARRAYAGG but I don’t know how to print a correct json. Query: PHP: OUTPUT: Answer You are encoding colors twice. First in SQL and then in PHP. What you can do is either decode colors in PHP before you…
Rewriting an anonymous function in php 7.4
There is the following anonymous recursive function: I try to rewrite to version 7.4, but there is an error, please tell me what I’m missing? Notice: Undefined variable: f Fatal error: Uncaught Error: Function name must be a string Answer Just like Barmar said, you can’t use $f from the outside sc…
Add dynamic email address to post form
I have this code to post a contact form: $pp = new FormHandler(); $validator = $pp->getValidator(); $validator->fields([‘name’,’phone’])->areRequired()->maxLength(50); $validator->…