Category "php"

Do I need to cleanup files created by tempnam() myself?

I created a bunch of tempnam() files for use during my request. Do I need to specifically unlink() them when they're not needed anymore, or will PHP / the syste

$_SESSION array is empty after redirection - Wordpress

I have a WordPress page template themename/template-payment.php <?php /** * Template Name: payment */ session_start(); ?>

PHP: reading and parsing a nested JSON file

I want to use a json file as a kind of database. In it I have categorized file names and now I want to read them via PHP. { "settings": { "prefix": "pix", "

decoupling PHP plugin system

I am using PHP to build a simple plugin system in my own MVC framework. Here is the algorithm I am using to load the plugins: Scan the plugins directory. Use th

while() in while() or 1x Query?

I don't know which way would be better for PHP and SQL. I design and program my own comment system and I would like id2=0 its a comment and id2>0 its sub-com

Autoplay Youtube video with sound on?

I have been looking all over the place and never found an answer to this question. It's either you have autoplay and no sound. Or with sound but without autopla

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