Questions tagged [php]
PHP is an open-source, multi-paradigm, dynamically-typed, and interpreted scripting language designed initially for server-side web development. Use this tag for questions about programming in the PHP language.
1,466,590
questions
0
votes
0
answers
2
views
A custom CodeSniffer check is not executed
I have a custom sniffer in ./src/StaticFunctionSniff.php file:
<?php
declare(strict_types=1);
namespace App;
use PHP_CodeSniffer\Files\File;
use PHP_CodeSniffer\Sniffs\Sniff;
class ...
0
votes
0
answers
10
views
if I enter mobile number and its give OTP but its not navigate next page . how can i solve it
[enter image description here] -----img1 (https://i.sstatic.net/82ibUUbT.png) ------img2
child: Button(
height: 6.3.h,
width: 55.w,
...
-3
votes
0
answers
15
views
how to make the system sort by name
how to make system sort by name using php programming language
I want to have a code that will make my system sort by name, the name should follow alphabetically I want my system to have a sort by ...
-2
votes
2
answers
20
views
how to display this data with while loop or for loop
I retrieve data with the post method as below
$no_wa1= $_POST['no_wa'][0];
$no_wa2= $_POST['no_wa'][1];
$no_wa3= $_POST['no_wa'][2];
then I want to display the data above with a while loop and a for ...
2
votes
0
answers
18
views
What happens inside stack when you add an additional element to an array in php?
I learned php before learning C and C++. That's why when I found out that the developer must defined the length of an array when defining the array itself, I couldn't understand the underlying purpose ...
0
votes
0
answers
6
views
Adding a new item to easyadmin collection field overrides the last one
I have a project using symfony 7 and easyadmin 4.
All features worked fine untill I upgraded to the latest Symfony 7 release where editing CollectionFields by adding new elements started behaving ...
0
votes
0
answers
9
views
How to add custom application for default starter in phprunner
I want to add custom application for default starter in phprunner pro v10.
I mean, at the homepage of phprunner which we are going to start our project, I need to add my own custom admin theme as ...
0
votes
0
answers
12
views
Create CSV file with PHP using a WHILE statement with a twist
Data from the table
123 CA
456 FL
33 CA
This works:
$file_name = "table.csv";
$sql="SELECT filename,state FROM table1";
$result=mysqli_query ($dbc,$sql);
$fp = fopen($file_name, '...
1
vote
1
answer
25
views
Converting this preg_replace to match a word with a plus
In PHP I need to highlight multiple given words in a string, for example wrapping found matches inside a <em> tag.
But if I have a word ending in + I cannot do it.
I understand the below problem ...
-3
votes
0
answers
13
views
How to list articles from the last 3 days on a page with wordpress function code? [closed]
Please help, we need guidance how to insert / display list of articles from the last 3 days on a page with wordpress function code?
i have searched many times but still didn't find the answers ...
...
1
vote
1
answer
22
views
Redirect guests from WooCommerce checkout to My account login and back to checkout once logged in
I use the following code (pasted in my theme functions.php file) to redirect unlogged users from checkout page to WooCommerce My Account login form:
add_action( 'template_redirect', '...
0
votes
1
answer
31
views
PHP PDO error - SQLSTATE[HY093]: Invalid parameter number
could someone have a look at my code and help me figure out what is causing the error in my PDO query.
The query works fine when I search by "Department", "Datarange", "...
0
votes
0
answers
11
views
Is there a PHP MSK Client library that supports using IAM roles
trying to use php client to connect to a MSK kafka cluster setup to use IAM roles
All code I can find shows the need for a username and password in the SASL config, is there a way to use IAM role ...
0
votes
0
answers
12
views
Laravel Filament Form export to PDF
I want to send an email to the customer after filling up the form, I tried to use Barryvdh\DomPDF for that, I had two functions loadHtml and loadView,
I tried this way :
controller :
<?php
...
-1
votes
0
answers
17
views
Connect PhpStorm debugger to Xdebug with Warden
I'm getting an old Magento 1 project up and running, and am hitting issues getting the debugger working. Everything is run on Docker, using Warden to manage the different containers. I've followed the ...
0
votes
0
answers
21
views
Is there a way to tell WordPress to use a page theme as the styling of the login page?
I am needing to make a custom login page for my website but need things that are just unavailable (or not available for free) from any of the login page customization plugins. I have created a page ...
-1
votes
2
answers
36
views
Display logged in user information
I have got a basic registration and login forms and when the user registers then their information is sent to the database and when the user uses the same username and password then they can login ...
0
votes
0
answers
10
views
Uploading from OneDrive/Sharepoint in Laravel App
I'm looking for a solution to allow users to authenticate then upload files from their Sharepoint/OneDrive to S3 within a Laravel application. Has anyone been able to accomplish this before?
I've only ...
-1
votes
0
answers
19
views
How to create coupon/paywall in an Elementor Pro page for FREE [closed]
Is it possible to create a page with a coupon code form, then the selected visitors need to enter the valid coupon code I emailed to them, and if the coupon code they entered is correct, they will be ...
1
vote
2
answers
36
views
PHP HTML JS pagination
I have a page which feedbacks which looks like this (I just show 1 comment per page to see if the pagination works fine. Otherwise I'll show more):
The feedbacks come from a mysql database and are ...
0
votes
2
answers
22
views
PHP variable from mysql query in form, when null
I have an html form used to edit a record in a mysql table.
In the case of editing, I prefill the form with the current values for the record as returned by the query, as below:
<INPUT TYPE="...
-2
votes
0
answers
19
views
comment résoudre le problème de memoire limité de laravel [closed]
PHP Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 360448 bytes) in D:\ibetaservice\vendor\laravel\framework\src\Illuminate\View\Engines\PhpEngine.php on line 52
...
-3
votes
1
answer
26
views
Laravel maintenence mode timestamp?
Does anyone know an easy way to get a timestamp of when your laravel app is put into maintenance mode? I want to display a message on my view which says "last updated xxxxx"
0
votes
0
answers
11
views
Error with Doctrine ORM attribute after converting code from annotation
I am upgrading from PHP7 to PHP8, ran my doctrine entities through Rector to update the annotations to attributes. I'm getting the following error that I cannot get past:
Attribute "Doctrine\ORM\...
0
votes
0
answers
17
views
How to sort WooCommerce variable products from max variation price in a custom query
I am trying to sort WooCommerce variable products from maximum variation price (my website contains simple and variable products).
My custom query below is sorting products by price, but the issue is ...
0
votes
0
answers
15
views
How to allow customers to update their sales channel in admin interface in a Shopware 6 plugin?
I'm working on an e-commerce platform where customers are assigned to sales channels. Currently, this information is stored in the database, but can only be updated through direct database queries. I ...
-3
votes
1
answer
37
views
Including navbars using Php [duplicate]
I've been working on my first ever fully fledged web project to try and learn php, and after copying and pasting my top navbar into the 15-ish pages that I have and the styling for it into the 15ish ...
-1
votes
0
answers
22
views
Laravel is not rendering pages and is way too slow, literally unusable [closed]
I am trying to deploy a laravel app to a ubuntu server, i have installed php, composer, mysql, and apache. I upload the files to /var/www/html and set up the database, but the pages are not loading at ...
0
votes
0
answers
20
views
woocommerce_cart_item_price doesn't update mini cart subtotal
I am adding an array of free gift products to the cart when certain conditions are met. I have used woocommerce_cart_item_price to set the price of the products in the mini cart. However, it is adding ...
0
votes
1
answer
35
views
Display an Alert When User Session Expires in Laravel
I am using the Laravel framework and would like to create an alert when the session expires. I tried implementing a JavaScript code that checks if the user is logged in every three seconds as follows:
...
0
votes
0
answers
15
views
IMAP Error: EXPUNGE not allowed in session state when creating folder in Laravel
When trying to use the EXPUNGE command after creating folders with the IMAP server, we receive the following error:
BAD [ALERT] i.<unique_id> EXPUNGE not allowed in session state
The EXPUNGE ...
0
votes
0
answers
15
views
Filtering by Custom Taxonomy and Meta Fields in WordPress Produces Inconsistent Results
I'm building a custom WordPress theme for a job listing site, and I'm encountering an issue with filtering job listings. My site has custom post types and taxonomies for job categories and job types.
...
0
votes
1
answer
14
views
PHPSpreadsheet, how do I set different layout for each series in a composite graph?
I am trying to create charts in excel using the PHP library PHPSpreadSheet. But when I generate a composite graph with multiple types of graphs together, I get overlapping data labels.
Stacked bar + ...
0
votes
0
answers
16
views
TBS TinyButStrong on PHP laravel : pptx template that doesn't work with certain fonts or font colors
To sum up quickly: I'm working on a mutual insurance application where the salesperson can generate a powerpoint. The powerpoint is generated thanks to a template and this template is filled with tags ...
-3
votes
0
answers
23
views
Loading local host slow [closed]
So i am doing a project using Laravel Php, so actually the project has been upload on live server, and the issue i am having is i am task with modifying the webpage a little, but the issue is after ...
-1
votes
1
answer
29
views
laravel model pages not communicating properly
Working on a client project, hit a setback.
Laravel is reading
"Call to undefined relationship [service_item] on model [App\Models\Service]".
It's simply trying to read data from two ...
-2
votes
0
answers
25
views
Laravel 10 migration data type ( Exg : text, string, longtext ... Etc.) size list in charector and size(kb pr mb)
Laravel 10 migration data type (Exg: text string longtext etc.)
Data type
size KB (char)
String
xx kb (cab)
Text
xy kb (acb)
Can anyone share this list.
A list of data type and it's sizes ( ...
0
votes
1
answer
21
views
getRoleNames method as an accessor in user model. Spatie Laravel Permission
I am trying to create an accessor that will return the users role name. It is possible to access the getRoleNames() method in the User model?
//User Model
/**
* The accessors to append to the ...
-2
votes
0
answers
25
views
React app is giving me CORS policy error. How can I fix it?
I'm trying to make a login page in React using Vite. To verify login credentials I have created an API in PHP. When I test the API with Postman it returns a data but with my react application it is ...
0
votes
0
answers
39
views
Easy way to autonomous periodic data update in Laravel, PHP
How can I autonomous calculate and update value for one column in my Laravel project? I have no much experience in web-dev, so I just dont how to do it effective.
For example, now I've column "...
-1
votes
0
answers
14
views
Laravel MongoDb Aggregation For unique and null
I want to retrieve documents from mongoDb by using MongoClient for parent_id is only first of same and parent_id is null.Only one aggregation.
$search[] = [
'$group' => [
...
-2
votes
1
answer
35
views
PHPUnit 'Error : Class "path\to\class\classToTest" not found'
I'm trying to write some unit tests. However no matter what I do I keep getting this error:
Error : Class "path\to\class\classToTest" not found
The test I'm trying to run has a simple ...
0
votes
0
answers
23
views
A circular reference has been detected when serializing the object of class Symfony error
I am reaching out because I am encountering a circular reference issue. I am using version 7 of the symfony framework I have tried to implement several solutions, such as the attribute: #[MaxDepth(2)]....
0
votes
0
answers
29
views
Using Puphpeteer to scrape web page with no classes or ids [duplicate]
I'm helping a friend to migrate their blog from a "homemade" platform to Wordpress and the original developers have not been helpful in extracting the content so I'm trying to figure out how ...
-3
votes
0
answers
30
views
Get sum of values in multi array [duplicate]
I have an array with different keys, and I am interested in the sum of the values of only the ones that start (or contain) "MT".
$json = file_get_contents($path2);
//echo $json.'<br&...
-3
votes
0
answers
31
views
how can i correctly return array value to jquery [closed]
<?php
include ('config/dbcon.php');
if (isset($_GET['visa-id'])) {
$visa_id = $_GET['visa-id'];
$query = "SELECT document, preference FROM visa_document WHERE visa-id = '$visa-id'&...
1
vote
1
answer
46
views
How to modify a PHP class to accept PgSql\Result as an attribute
I need to find a way (if possible) to make a PHP class accept a PgSql\Result object as an attribute. PHP 8.1+ has migrated the pgsql result resource to the PgSQL\Result instance. In prior versions ...
0
votes
1
answer
33
views
Problems with LVE ID 5487
I made a php application that uses the spatie library top convert pdf files to jpg, using ghost script and imagickMagic.
The process is slow, but in dev enviroment, it works fine. I just ajusted the ...
-1
votes
0
answers
46
views
Session variable into a prepared statement [closed]
When I submit a form, I would like the Session variable user_id to carry through to my prepared statements so it can be inserted into my table.
Code of dev.inc.php (following comments...)
<?php
if(...
-1
votes
0
answers
26
views
Cannot connect to Postgres from my php/symfony application
I'm having issues connecting to any database from my php/symfony application
when I try to connect to pg_connect("host=localhost port=5432 dbname=dbname user=username"); the app just dies ...