Category "php"

MISSING UPDATES FOR: MEDIA Drupal 9

I have started facing an issue with locally hosted Drupal 9 (Xampp, Windows 10). The issue started when I was trying to create events in drupal 9 and I was redi

virtctl works when executed via command line but not from php exec()

I am trying to run kubectl virt commands to manage my virtual machine via PHP. First, I log in to my server with phpseclib with the following code: $ssh = new S

Adding hreflang tags automatically in WordPress subdirectory multisite

We have a WordPress MU subdirectory network setup: www.example.com - main website, USA, global www.example.com/uk/ - to display for UK visitors www.example.com/

Symfony 4: how to safely 'join' migrations together? / remove migrations in between the first and last?

I was recently tweaking around with my DB and noticed that I made 5 migrations on top of my existing 2. So 7 in total, m1, m2, ..., m7. From these 5, I only wan

Custom WooCommerce shortcode to display product image gallery

I have been tasked with duplicating a WooCommerce product gallery in an internal page (not a product page). As such, I decided to create a Child theme and write

"Notice: Undefined variable", "Notice: Undefined index", "Warning: Undefined array key", and "Notice: Undefined offset" using PHP

I'm running a PHP script and continue to receive errors like: Notice: Undefined variable: my_variable_name in C:\wamp\www\mypath\index.php on line 10 Notice: U

Maatwebsite Excel 3.1 : how do I skip duplicate data when imported?

I made import data using Excel on Laravel Maatwebsite Excel 3.1. but when in the database there is the same data (Primary Key) then there is an error message

Installing Composer - Internal Error

I have trouble installing Composer. After I select the php.exe path in the wizard and next thing it shows is the below error description. The PHP exe file

PHP: Telegram Bot: Insert line break to text message

"\n" and "\r\n", tested in text message sent by telegram bot, to create line break. Instead of showing line break, underline _ will appear after using them.

Prestashop webservice API creating cart rules

Have been trying to create a cart rule using Prestashop web-service with no luck. Tried this https://github.com/PrestaShop/PrestaShop-webservice-lib/blob/mast

Chunk and transpose a flat array into rows with a specific number of columns

An array of values are provided in the order they should appear in columns. For example, the second value in the array should be displayed on a webpage beneath

Make certain characters of a word from string bold

I need to highlight a certain characters from a string, I tried str_replace and preg_replace. But these work only if full word is entered, $text = str_replace(

Why does array_map() with null as callback create an "array of arrays"?

Today I learned about a special case of array_map() in PHP, which is mentioned as a side note in the documentation: Example #4 Creating an array of arrays

Having trouble with PDO queries (Notice: Undefined index)

I'm trying to extract a data from database, I'm using PDO to do it. I have the following PHP code without success: public function CheckIdentity($email, $passwo

Failed user login on production server using Symfony framework (Authentication request could not be processed due to...)

I'm using Symfony for a project and I have been trying to get the login to work on production server with no success for the past 2 days. I keep getting the err

Handling expired token in Laravel

What is the best way to handle expired tokens in laravel 5. I mean I have a page and it has some links which perform ajax requests. They work fine when the pa

Laravel relationship belongsToMany with composite primary keys

I have 3 tables and I'm trying to make relations between order_products and order_products_status_names. I have transition/pivot table named order_product_statu

Facebook API, get page post link (PHP)

Here's some code: $facebookUrl = 'https://graph.facebook.com/'.$facebookPageId.'/posts?&access_token='.$facebookAppId.'|'.$facebookAppSecret; $facebookData

WHERE IN array binding in DB::raw laravel 5.4

I'm trying to bind an array in a raw WHERE IN query in the Laravel DB example: $arr = [1,2,3]; DB::select(DB::raw("select * from test1 WHERE id IN ? "), [$arr

How does this Facade works

I'm working with Laravel 5.8 and it's an Online Store project written by other programmers. Basically I have faced something weird that never seen before. Let's