Category "php"

How to update MySQL column/row when datetime column < now?

I am making a platform where people can make bids on items for a price. I want to make it so that after a the expire datetime of the item, the database will aut

Creating employee in Xero PHP SDK

I have copied the sample code from the Xero developers site but keep getting an error with the DateOfBirth here is the code <?php require_once(__DIR__ . '/ve

How to repopulate multiple select boxes and checkboxes

I cannot find a way that works to re-populate multiple select boxes, Since it is stored as an array is there a way to cross-check and repopulate the selections

How can I fetch data NOT IN another query array using PHP PDO [duplicate]

From the second query, I want to get users whose id are not in the first query. Please how do i run this? Below is what I have done so far. Th

JoinColumns/Composite keys with php attributes

How do you declare joinColumns/composite keys with PHP attributes. Haven't been able to find the right way and it is not documented (https://www.doctrine-projec

Multilines message into WhatsApp API Using Textarea, POST and json playload with PHP

i am using WhatsAPP API of One of Facebook Partner. I have a form with text area , Message content of textarea is POSTed to sendWhatsApp.php and inside of sendW

updateOrCreate Function in laravel

Code is fine and I'll double check my code but I didn't find anything wrong in my code. This doesn't update or insert address or new user data in any condition.

Expected type 'object'. Found 'string|false'.intelephense(1006) on json_encode()

Please find my code sample below where I take the POST input data and convert into JSON after which I check if the data has the required info or not. I'm using

Best practices for declaring class constants with PHP?

When I design classes in PHP and I need (or want) a constant I usually declare it as a class constant like this: class MyClass { const FOO = 1; } Then I ca

Laravel relationship HasMany

I keep multiple address records belonging to a user. but when i write with dd i can't access other table's data. Following my code: user Table id | name

How can I run PHP Code locally within a WebView App?

So I have been issued a project with tight restrictions, I need to run php files stored in local app directory for a WebView application. However I dont even kn

two toolset custom post type connect with relationship to change permalink structure

i create two custom post type using toolset plugin 'movie' and 'song'. The movie post title is 'titanic' and url is example.com/movie/titanic. The song post tit

Preview PDF file in a HTML modal, then print to a paper size using PHP or JS

I need some php or javascript script first to display a PDF file in a HTML modal (client browser) and then to print a PDF file from html modal (client browser)

dynamic select2 options depending on other select's selected option

I have the following select <select class="form-control" id="from-location" name="from-location"> <option value="1">Inventory 1</option&g

PHP bug in exact calc

See the calc: var_dump((75.2 >= ((94 * 1.8) - 94))); // return false; var_dump((75.200000000000001 >= ((94 * 1.8) - 94))); // return false; var_dump((75.2

Extracting data from the 2nd table by looking at the condition in a table with php

In my table named Follow, there is the information of those who are followed. For example, let's say my user id is 1: tableID | followerID | followedID ________

Message: Trying to access array offset on value of type int

How to resolve this issues: Trying to access array offset on value of type int? PHP8 public function processPayment(Request $request) { $orders

What is the safe way to adding an FTP user through PHP?

There is a form on the website with "FTP username" and "FTP password" for administrators. How to safely add the FTP user by PHP? Because curre

How can I hide products from the shop after certain time out of stock?

I'm managing a big store that has a really big rotation of different products. We get new products, after a few days they sell out and then we may or may not re

run migration for different database connections

i have two mysql connection and i want to migrate specific database with php artisan migrate --database=databasename and when i ran command php artisan migrate