Skip to content

Tag: php

Subtracting days from a future date

It is working as expected. $newdate prints as 1 December 2022 However, if the $tour_date is not the current year, it does not work properly. It is still printing as 1 December 2022. The $newdate prints as 1 December 2022. But it should be 1 December 2023 which is -10 days from 11 December 2023. Any idea, that will work

How to create if statement in foreach in php

How to create if function in foreach in php I want something like this if(currency==id) script should exclude it Here is the php code Answer Assumptions: You want to exclude all items that have the same id and currency. Each item in the result should have the keys ‘id’ and ‘currency’. You may use the functions array_map and array_filter to

Laravel migrate ends up in wrong database

I have the following settings in .env When I run Everything seems to be ok. But when I look at my target database “unwa”, it is empty. A die and dump revealed, that I was connected to another database “auction” that happens to be the first (alphabetically) database. I find all my tables in the “auction” database. How can I

Get Possible Order Date Based On Multiple Conditions

I can’t wrap my head around this particular problem. There is a bakery, and an office that accepts orders. Bakery is open from Monday to Sunday, it’s only closed during public holidays. Orders can be placed from Monday to Friday unless it’s a public holiday i.e. the office is open during working days. We also need to distinguish if the

.htaccess – Permanently redirect to root when the website is accessed with with no query string parameters?

I am using a template on my website. This template is designed in a way where everything is in the index.php file but the functions are executed based on the query string which is stick to the index.php file. I want to permanently redirect to the root when my site is accessed with index.php with no query string parameters,

How to pass the id of a client by a html button in javascript

here’s my problem: I’m making a client system in javascript and php. I would like to be able to delete the account of a customer who has a unique identifier (id=x) by clicking on a “Delete Customer” button. The problem is that to bring a little dynamism, I treat the request in javascript in this way: My request is as

MediaWiki w/.git:Unable to open all skins. throws uncaught exception

”’Fatal error: Uncaught Exception: Unable to open file /skins/MinervaNeue/skin.json: filemtime(): stat failed for /skins/MinervaNeue/skin.json”’ I tried running MediaWiki 1.38 (upgraded from 1.37.x) and tried using .git. Everything went smoothly, but after configuring the install through the browser (mw-config) I went to the site and got an 500 error. I turned on error reporting and got that error above (over and

how to simplify this complex query

This is an extract of one of my php functions. I’m struggling to get this optimized as is super slow, as I need to load all interview records, and then check if the current user is either assigned as user_id on the interview record, or if the user->id is in the interviews shared_user_ids which is json I’m also using PostgreSQL