I have a forum page. On the only index page, I show an online user list that shows usernames. I use Pusher. It works great. I have a problem about which my customer is complaining. The problem is that when a user browses to other pages, his/her username disappears and re-appears again. His/her connection to P…
Tag: php
How to carousel in loop?
I am trying to loop carousels with class “active” first item here is my code I trying to put active item in the loop too. Answer You can use $loop->iteration==1 as said in laravel blade doc inside the foreach:
Default to an option on a dropdown option
I’m trying to get a dropdown menu to default to a certain value depending on an employee number, I have managed to get it to say it but it’s not the right option as the options are pulled in from on MS SQL server, so it just created 2 options for ‘Labour’ for example, there’s the…
How to use Google translate to translate strings.xml files to other languages in php
I’m using Google translate to translate strings.xml files to other languages from English. But translating more than 1000 lines one by one takes too much time. Is there an easy way or code to do this? How do you translate your xml contents to other languages? from: to: Answer The input text can be plain…
Custom “Out of stock” text based on product category in WooCommerce
Every out of stock product says “Out of Stock” There are plenty of functions.php scripts that overwrite the text but I am only trying to overwrite the text specific to “Category A” or if I know the category “id” number, that could work too. I found this script but it allows…
How to display the first image name from a string of image names
This is my array. I want to print the first image name from the key [image_names] [prop] => Array ( [0] => Array ( [id] => 1 …
PHP: Get client MAC address
i want to get the client MAC address from an connected socket. usually you can get the IP-address via is there any chance to get the MAC at the same way? i know all about the facts that the real MAC is only available in a local network and also this hack: but i want to avoid to execute an
php pdo how to pull down and set default values from the database
I would like to ask how I can use the foreach to select the value brought out of the database to the default value. For example: my database value is 15 * 90, how to select option =15 * 90 I use PDO here Answer You need to create a loop to process all the results from the query and
How to sort an array B (multidimensional) in php by the order of values in an array A (1 dimension)?
The alphabet is a substitute for the same specific character so that it is easy to see. order case-1 order case-2 Array to be changed result by case-1 or (Anything will be fine.) result by case-2 or (Anything will be fine.) tried code is like this. Answer I would say that a usort would be your best option her…
Woocommerce Change product price by ID
I have an array with product id (post_id). My goal is to loop thru this array and change all the product prices in WooCommerce products. Here is my attempt: foreach ($array as $product) { …