So, I’m trying to connect to my database container from my webserver container. I currently use Codeignter 4 for my PHP framework. Everything goes well in terms of communicating between different containers because that container is inside the same networks. Inside webserver container, I’ve tried …
Tag: php
Issues with beforeunload not preventing refresh/closing
Trying to prevent closing/refreshing with beforeunload and an embedded typeform but it doesn’t seem to display the warning message. Is there something I’m missing? Answer resolved with overscroll-behaviour
How do you find the closest value to a number in an associative array?
I have an associative array with 15 different companies and their stock prices, formatted as shown below: I have found the average stock price: The average ends up being 161. But I now need to find the closest number (absolute terms) to that average value (161) within the associative array. I need to display …
How to fix “Uncaught Error: Call to a member function get_tax_class() on null” in WooCommerce?
I’ve an ecommerce app that’s was working fine some days ago. After I update the wordpress and woocommerce plugin, the app suddenly stopped working. I think that’s something about the plugin that I use (mstore app-mobile), but unfortunately is not possible to update this plugin. The error hap…
imagecreatefromweb causing FATAL error which cannot be caught
I have a simple block of code that when fed an invalid file should be able to provide some user feedback, but I am finding the call to imagecreatefromweb** simply stops all PHP processing with a “Fatal error: gd-webp cannot get webp info in ..” straight away. I have tried to place this in a try ca…
Do modern browsers support onchange=”this.form.submit()” for file upload?
I would like to have an upload form that automatically submits as soon as the user has selected a file. This question has been asked many times before. If I understood the other threads correctly, this should work: When I select a file, I see the file name briefling flashing instead of the “no file chos…
Use more placeholders in WHERE statement after IN statement with arrays
I need more placeholders to be added to the following query. Is this possible? I have no idea where to begin and I can not find any options on the Internet. The query now: $in2 = str_repeat(‘?,’, …
How to make a redirection to checkout on a custom add to cart button in WooCommerce
I’m using WooCommerce and added the following code to functions.php: What I would expect is that when a user adds a product to their basket: this code will redirect the user to the checkout page without actually adding the product to the basket. However, it still adds the product to the basket. What is …
after upgrade to php8.0, nginx still uses php7.2 for PHP-FPM
I’m running Ubuntu 18.04 with nginx/1.14.0. I have been running PHP 7.2 but some of my web applications require a newer php for security reasons. Since it is nginx, I use PHP-FPM. I used apt to …
array_search returns NULL/blank
I have such array “uniqid1”, “apple”=>”uniqid2”, “apple”=>”uniqid3”, “bannana&…