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,306
questions
0
votes
0
answers
11
views
I'm getting 401 Unauthorized when accessing protected routes using http only cookies in Laravel with axios
I'm working on a Laravel application with JWT authentication, and I'm trying to use http-only cookies for authentication. Despite setting the cookie correctly on login, I'm still receiving a 401 ...
0
votes
1
answer
28
views
Laravel Observer depedency injection gave a collection instance
Laravel Observer depedency injection gave a string type attribute instead of an integer.
I faced a problem with Laravel Observer because it gave me a collection with the wrong attribute type (integers ...
-1
votes
0
answers
21
views
Symfony Backend with React Js Frontend
I Create a react js frontend, and a symfony 7 Backend using api Rest and axis ,first I test the connection between the back and the front it works ,but when I continue on developing the Backend and ...
0
votes
1
answer
25
views
unknown urls in my Google Analytics performance dashboard
I have a hobby wordpress website with around 4 pages and 4 posts in total. Google notified me that my website has "malware". The link that I was notified was this:
I checked my Google ...
-3
votes
0
answers
21
views
SQLI - Do a select criteria on a field as if there is a string added to it [closed]
Database contains products table
Some users have there own article id's with another prefix.
Lets say prefix YYY.
I thought a query like underneath would give a match:
SELECT * FROM products WHERE &...
-1
votes
0
answers
18
views
How to correctly save an apostrophe in WordPress Database?
When I tried to save the user input in the database, if the user uses an apostrophe ( ' ) then in the database it is saved with a slash ( / ) before the apostrophe. So for example if the user enters &...
0
votes
0
answers
20
views
Ensuring casts are applied before Laravel data constructor is called
I am attempting to make use of the laravel-data package from Spatie, in order to ensure a typed contract between different layers of my application. Unfortunately, I'm having trouble with casting ...
-3
votes
0
answers
17
views
How to use PRG? [closed]
Hey guys I've been doing a project and I'm getting a problem when posting the information because everytime I post some information in the browser and it gets sent in the database it comes doubled I ...
0
votes
0
answers
6
views
Laravel Livewire wire:modle and wire:click showing 404 on cpanel but works fine on localhost
Laravel livewire works perfectly on localhost but when deploy to cpanel; shared hosting, wire:click and wire:model, not working, for example I have a live data search implemented with livewire, but ...
0
votes
0
answers
13
views
Laravel Livewire autocomplete
I am new to livewire and i just want to build an autocomplete, but i dont know if my code is correct or not because when i type in my input, i dont have any errors in Network or in my Console here is ...
0
votes
0
answers
14
views
Woocommerce remove out of stock products
I am using this code from here.
It deletes products if both the status is “Out of stock” and the product itself was edited more than 60 days ago.
How can I change this code so that it counts 60 days ...
0
votes
0
answers
17
views
Steam Web API doesn't return content
I'm working on an addon for my Garry's Mod Server. I tried to get the username and avatar from the players, but it doesn't return anything.
$id = $_GET["steamid"];
$url = file_get_contents(&...
-1
votes
0
answers
21
views
i want to show three tier MLM Tree but it is not showing properly
I have a three-tier MLM tree with four levels: Basic, Gold, Silver, and Bronze. Gold, Silver, and Bronze are parallel to the Basic level. Every third member added under anyone becomes a Gold member.
...
0
votes
1
answer
21
views
Base table or view not found: 1146 Table 'example_app.sessions' doesn't exist
I am trying to set up Laravel 11 on Windows 11. I am using WAMPServer for Apache/PHP/MySql.
I have installed the installer globally using Composer. I then run this command to create a Laravel project:
...
-1
votes
0
answers
19
views
Why can I hook ZEND_ECHO but not ZEND_INCLUDE_OR_EVAL?
In php5.6.30, i have following code:
<?php
eval("system(\"whoami\");");
the opcode is:
line #* E I O op fetch ext return operands
------...
0
votes
1
answer
39
views
How to Revive an Old Symfony Website with Deprecated Bundles?
I'm currently facing a challenging issue and could use some advice.
A client approached me to integrate the Gutenberg API into their website, which is built with Symfony. The website is deployed and ...
-3
votes
1
answer
49
views
How can I extract only the text content from an HTML string in PHP? [duplicate]
I have HTML strings stored in database, and I want to extract only the text content, stripping out all the HTML tags. What is the best way to do this in PHP?
I want to extract the plain text. How can ...
0
votes
0
answers
30
views
Laravel: How to insert entries into a specific table [duplicate]
There is an issue with inserting entries into a specific table.
Usual methodology (model)
Creation of an table (portfolio_item)
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\...
0
votes
0
answers
50
views
php opendir how to get files what sorted numeric
how to read files numeric? Im have from 0 to 20 files in directory and he gives me 1.txt 10.txt 11.txt 12.txt 13txt ..., not 1.txt 2.txt 3.txt ...
im not wanna use glob or scandir, because i dont want ...
0
votes
0
answers
31
views
moment.tz not defiend on home page
I've tried to read everywhere and asked chatgpt but i cant find a solution.
i created this plugin here and its working fine via the following page https://nourhammoury.com/
However, on this home page, ...
0
votes
0
answers
33
views
Laravel 10: Target class [App\Http\Controllers\app\dashboard\dashboardController] does not exist
I tried logging in a user (email and password) to the user's dashboard page but got the error message:
Target class [App\Http\Controllers\app\dashboard\dashboardController] does not exist, after ...
1
vote
1
answer
37
views
Reply Depend on current and previous Status
I have this code tend to achieve this
If the user has previously asked about Nrat and then says "Thank you": The reply should respond with a specific Nrat-related response.
If the user just ...
-1
votes
0
answers
19
views
Empty cache and weird first page loads on symfony 7.1
In my symfony 7.1 (php 8.3) application, on the registration page, the first attempt to submit the form always results in a console error message "turbo.index-810f44ef1a202a441e4866b7a4c72d11.js:...
-8
votes
0
answers
27
views
I got an error while sending notification [closed]
Can I ask? I coded the bot using JavaScript, but when I tested it, it said it was normal, but when I uploaded it to Git, it got an error, why?
Can I ask? I coded the bot using JavaScript, but when I ...
0
votes
0
answers
19
views
how can i show Multiple Images of Products inside the database mysql using php js
Only 1 image from the database is pulling inside the modal which is the class= "main-image"
<?php
session_start();
// Check if the user is logged in
if (isset($_SESSION['username'])) {
...
0
votes
0
answers
21
views
I can still see contents of directories on apache linux [closed]
The content of my .htaccess file are as follows:
Options All -Indexes
AllowOverride None
I have Amazon Linux 2023 image and this is not working. I can still see the content of the directories. Can ...
0
votes
0
answers
11
views
Message: mysqli::real_connect(): (HY000/2002): No route to host [duplicate]
i have codeigniter 3.1.11 on ubuntu 24 and i am not able to connect mysql
here my error message
Message: mysqli::real_connect(): (HY000/2002): No route to host
even my username and password are ...
-1
votes
0
answers
37
views
Best practices for database error handling [closed]
This problem came up when I started to do unit testing for a website that I wrote. Whether I mock the database or spin up a Docker instance to use is a question for later, but what really got me ...
-2
votes
0
answers
24
views
Live Sql Java DropDown List from Main Category
Sorry guys, I'm being silly again. I definitely need to stop drinking!
Trying to create a live make / model search box for vehicles as you'll hopefully tell from the below code.
Any help / overview ...
0
votes
0
answers
9
views
I want to create a query that will fetch all the categories and fetch all the products for the provided category in arguments
Here is my index file with url paths:
<?php
require_once __DIR__ . '/../vendor/autoload.php';
require_once __DIR__ . '/../app/Config/bootstrap.php';
use FastRoute\RouteCollector;
use FastRoute\...
0
votes
0
answers
11
views
Composer Install Fails with File Deletion Error in Docker on Windows
I am experiencing an issue with running composer install inside a Docker container on my Windows 11 machine. The installation fails while trying to delete a directory, and I receive the following ...
-1
votes
1
answer
33
views
PHP Limiting readdir
I want to show the first 10 files, but not scan the entire directory. Show the first 10, then another 10 and so on until the end.
I found this script, but it doesn't actually work.
<?php
$start = ...
0
votes
1
answer
22
views
Form with multiple inputs into fields for PHP processing
I've got a form with multiple sets of data (which are variable) which I'm attempting to pass into PHP and then for each group of fields, have the individual data into PHP variables ready so I can work ...
1
vote
0
answers
34
views
How to valdate items from array in Laravel
I have a question, how can I validate the elements of an array against each other in a request? For example, I want the documents.*.end_date to be required if the selected document has a property ...
0
votes
1
answer
34
views
Opening HTML tag disappears when I close it
When I'm in the process of closing an HTML tag, the opening tag gets highlighted, and when I finish closing the tag, the opening tag disappears. Why is this happening? It seems to only happen in .php ...
0
votes
0
answers
20
views
Custom Dropdown input automatic search behavior in Woocommerce Wordpress
I have 2 custom made dropdowns in Woocommerce, that act as filters for products, one including all brands in the site, the second all level 2 categories. They have an automatic tigger search function ...
0
votes
1
answer
23
views
I can't install Composer on my XAMPP with Xdebug
When I try to install Composer I get the following message:
The PHP exe file you specified did not run correctly:
C:\\xampp\\php\\php.exe
Program Output:
Xdebug: \[Step Debug\] Time-out connecting to ...
-1
votes
0
answers
8
views
Product analytics with amplitude from log services [closed]
Does any one knows solutions that can store business logs from application and send them to services like amplitude.
So basically I need log storage with possibility to transfer data to 3rd party ...
2
votes
1
answer
31
views
I keep getting this error "Cannot access offset of type string on string" whenever I try to serve dummy data to my Laravel application
I am trying to serve some data to my view. However, when i try to access the elements in my dummy array, i keep getting an error "Cannot access offset of type string on string". And I don't ...
0
votes
1
answer
13
views
Woocommerce add an `aria-label` to the product loop item link anchor tag
I am using WooCommerce and want to add an aria-label to the product loop item link anchor tag. Like:
<a href="http://localhost/shop/the-poets-philosophy/"
class="woocommerce-...
0
votes
0
answers
31
views
Second price information on the product page should change with a multi-currency converter
In my Woocommerce Admin Product area under:
Product Data > General: I have created a "custom input field" under the "Sale price (€)" field.
In functions.php this field is called ...
-1
votes
0
answers
16
views
Sentiment Analysis using Logistic Regression [closed]
Were currently conducting a thesis project, our study is mainly about analyzing sentiments of feedbacks using logistic regression, the data will come from database. We currently dont have any ...
0
votes
0
answers
23
views
PEAR binary directory is empty
I'm setting up my php setup, and I decided to install PEAR but even following the official installation I couldn't install. I downloaded PEAR manually through https://pear.php.net/go-pear.phar ...
0
votes
0
answers
26
views
Ternary in an array, string PHP [closed]
array
(
'head' => "Birth and Early Years",
'text' => array
(
"Jason A. Cloud was on <a href=''>Bellona</a>, Prime Hospital, to <a href='...
0
votes
0
answers
30
views
Fatal error: Uncaught Error: Class "'..'" not found
Since my hosting update my PHP to 8.2 I had a lot of problems, i solve a few of them, but this still and I can't figure it out how to solve it.
Fatal error: Uncaught Error: Class "'..'" not ...
0
votes
1
answer
30
views
composer not found for docker and codeigniter
This is all new to me. I am using Docker and CodeIgniter. I want to create an image for CodeIgniter in Docker. I am using Docker Desktop on Windows. I have a Dockerfile that contains the code below. ...
0
votes
0
answers
19
views
Re-ordering ACF Flexible Content Fields in Wordpress, not by order in PHP file?
Currently I have a single.php file where I am calling all my ACF fields, which are displaying all okay. The only issue is that they are displaying in the order they appear in the single.php rather ...
0
votes
0
answers
30
views
Change User's Active Directory Password using PHP Script
I am quite new to PHP so I suspect I am doing something wrong. I have written the script below to change a user password in MS Active Directory. I have confirmed SSL port 636 is open and SSL ...
1
vote
0
answers
25
views
Dompdf not rendering display: flex correctly in generated PDF
I'm using Dompdf to generate PDF invoices from HTML templates in my PHP application. The HTML/CSS template includes display: flex for layout purposes, but when rendered into a PDF using Dompdf, the ...
0
votes
0
answers
24
views
dynamic create procedure error using loop when invoking the procedure mysql [closed]
DELIMITER //
CREATE PROCEDURE CountRowsInTables()
BEGIN
DECLARE done INT DEFAULT 0;
DECLARE tableName VARCHAR(255);
DECLARE rowCount INT;
DECLARE totalRows INT DEFAULT 0;
DECLARE ...