Questions tagged [php]
PHP is a widely used, open source, general-purpose, multi-paradigm, dynamically typed and interpreted scripting language originally designed for server-side web development. Use this tag for questions about programming in the PHP language.
1,432,340
questions
-2votes
0answers
5views
How to fix Symfony DomCrawler slow speed (or alternative)
I've been using symfony DomCrawler to scrape data from a website using loop for multiple pages, but it takes a lot of time since I am scraping approximately 10000 pages. Symfony seems to be awful slow ...
0votes
1answer
7views
Cannot access to my PGSQL Docker container with PHP container
I'm setting up a CI using Docker using Github workflows for my Symfony project. I use for this an image of PHP8.1-fpm and Pgsql-13-alpine.
The docker-compose.test.yaml :
version: '3.3'
services:
...
-5votes
0answers
13views
PHP - Echoing variable name returns correct value, but using variable in query as tablename throws error [closed]
I am stumped by a problem that has been bugging me for a few days now and cannot seem to find solution for it.
In my application's back-end, I use a MySQL query in PHP to get table-name, stored in ...
0votes
0answers
11views
How to differentiate progressive downloads from full downloads on backend?
I have a site where we host audio files. Podcasts.
How on my backend I can detect whether my podcasts are being downloaded or progressively downloaded (online listening)? Is this even possile?
I tried ...
0votes
0answers
18views
Abstract class implementation in php
There is a code supporting calculation if a car is damaged.
Now it should be extended to support calculating if a painting of the car's exterior is damaged (this means, if a painting of any of the car ...
0votes
0answers
14views
Loop table row dynamically (Class Shedule Maker)
I am trying to make a student class routine from mysql data using php. Where each table row (day name wise like Monday, Tuesday) I have to put day's name manually,
I want to loop table row dynamic
<...
0votes
0answers
6views
sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC) returning all but empty records
I am creating a php API that fetches data from a stored procedure, the stored procedure is working fine on Dbeaver (retrieving records with values) but my api is retrieving null values without any ...
0votes
0answers
6views
how do I populate column 2 randomly from column 1 in this example array?
How can I populate column 2 with random from column 1 and column 3 with random from column 2 .... etc .... after column size is 1 ? Check if there is the same number on the column and display them in ...
0votes
0answers
12views
How to increment the HTML <th> and <tr> tag in php loop
I want to display data in HTML Table format as shown in screen shot below.
Every report has many different time. For each time mysql table has different student details. The time are supposed to be ...
-2votes
0answers
17views
strange behavior of getimagesize() function in php [closed]
hello guys i just want to write some code to control a URL of Image which comes from database is valid or not. try using getimagesize() function and i approach strange behavior of getimagesize() . the ...
-2votes
0answers
8views
PHP SQL code not working for wordpress database [closed]
I am fetching a column value of wordpress database and it is printing nothing.
$amount = $wpdb->get_var( "SELECT Money FROM wp2h_users where user_login = 'Sonali_skr'" );
echo &...
-6votes
0answers
19views
How do i decrypt this please DC96D644E0CE2A54A6BDF0DCEB0C9DB034ED826E [closed]
the web developer that designed my company website no longer works with my company, but i did some research and none of the decryption methods i saw worked for me.i want to decrypt the rest also
...
0votes
0answers
6views
Update & Insert data with php pdo unsuccessfully [duplicate]
I'm trying to solve this with quite a lot of code found on the Internet to update/insert MariaDB with PDO.
Some of it executes perfectly.
However, I don't know what's going wrong with a few pages; it ...
-3votes
0answers
17views
I'm trying to update the data from form into the database using php pdo but I'm getting the following error [duplicate]
Following is the code for updating. This is the code of update file
<?php
$id = $_GET['id'];
if(!isset($id)){
header("Location ./index.php");
}
require_once('./db....
-1votes
0answers
17views
How to get final result by combining two query results in Laravel?
I want to get income and expense results every day.
Table name : sales_records
id
product_id
qty
selling_price
sale_date
branch
1
1
2
1000
2022-03-25
1
2
1
1
1000
2022-03-25
2
3
1
2
1000
2022-03-...
-1votes
0answers
10views
How to make pte (pearson) like test giving platform for practice with AI scoring in Laravel [closed]
I want to creat a website in laravel for practicing pte exam just like language academy and real pte. I am confused for AI scoring I would greatly appreciate if you share me knowledge and idea for ...
0votes
0answers
12views
Display Order Status on Order Confirmation Page
I want to display the order status on the Order Confirmation page, or Thank You page.
We sometimes sell products in person, and it would be great to be able to see the order status as soon as they ...
0votes
0answers
7views
how to send data from admin dashboard to user dashboard in wordpress
I am trying to submit data from admin dashboard to user dashboard
<?php
$text = 'hello';
$userEmail = 'email@example.com';
?>
Given $text should be saved on existing $userEmail dashboard
0votes
0answers
18views
How to increase quantity of each item and calculate price in cart using php? [closed]
I want to increase/decrease quantity of a particular item in my shopping cart. But when I click the confirm button, the quantity of all items are changed then the price and total of other items are ...
0votes
0answers
7views
AppAsset $css property
I've recently started learning Yii2 Framework, and I face the following issue:
I'm trying to connect my css & js files via AppAsset class, here it is:
class AppAsset extends AssetBundle
{
...
-2votes
0answers
14views
PHP - UNABLE TO INSERT DATA TO TABLE [closed]
$sql =mysqli_query($connection, "INSERT INTO users ( FIRSTNAME, LASTNAME,EMAILID , PHONENUMBER , DATEOFBIRTH, username,password) VALUES ('$firstname','$lastname' , '$email' , '$phone' , '$DOB' , ...
-1votes
1answer
31views
Compare Values inside array php
I am a newcomer in Php.
Given below is my array
Array
(
[0] => {"tranc":["2"],"report":["2"],"company":["2"],"facilities":[&...
0votes
1answer
27views
I couldn't pass an img using ajax?
I'm trying to include a logo when adding a new airline, but I don't know how can I pass input with file type to the controller with ajax. I tried to use FormData(). I did not get any error, but the ...
0votes
1answer
23views
PHP $_FILES return empty
I have an HTML form that gets the input file and after the PHP to check the file and upload it to the server. For some reason the $_FILES return empty. Below is what my HTML form looks like:
<...
0votes
0answers
6views
when reading a file on app engine server there is none to be found
below code works well on my local server (XAMPP), however when i deploy on the app engine, it fails to read the docx file. It seems for some reason readDocx function is not able to access the ...
0votes
0answers
20views
I want to make SQL injection into checking login code. But it doesn't work
I'm studying SQL Injection with checking login code.
But it's hard to success the attack.
$check="select * from user_info where userid='$id'";
$result=$mysqli->query($check);
if($result-&...
0votes
0answers
9views
SQLSTATE[HY000] [2002] Connection refused (SQL: select * from `users` where `email` = datbui27497@gmail.com limit 1)
i have problem when i try to use database on xampp
i really think the problem from i use docker to my company and xampp for study so when i'm done docker and i just docker-composer down then i turn on ...
0votes
1answer
12views
Symfony Serializer circular reference due to many-to-many relationship
i require an api that retruns a json data so i'm trying to send json data via a controller in symfony and I'm using serializer but I'm having issues assigning groups to the attributes with the many to ...
0votes
0answers
7views
why kafka producer is not able to generare data
I am new to Kafka and using it with PHP. I have installed arnaud-lb/php-rdkafka as kafka php client. Following code, I am using to produce content, but It is not able to generate anything. Also, I ...
0votes
0answers
18views
How can I store array list in database using retrofit
Hello every i am new in android studio can you please guide me how i will use retofit for array
i have an array of string which i want to post as an array and store it in database local server but i ...
1vote
0answers
12views
Htaccess file rewrite redirects to unintended location
I had just started a new project and I wanted to remove the .php file extensions from the url. I did that with .htaccess file and this is my code for it.
RewriteEngine on
Options -Multiviews
...
0votes
1answer
11views
Joining two variable with a space between
I have two variables, $firstname & $lastname
I want to combine them as another variable $realname
So example: if firstname=John &lastname=Smith, then I want realname=John Smith
Would this be ...
-1votes
0answers
32views
How do I implement AJAX into a PHP user changing password form?
I have a small password reset form that is accessible to the user on their user account page once they have successfully logged in. I want to implement JQUERY AJAX so that the page doesn't refresh but ...
0votes
0answers
10views
Symfony 6 - Something wrong with getter
Hey I'm starting with php and symfony and something goes wrong when I'm trying to use Support's getter. Here is what I'm getting when I use dd($ticket) in showTicket function
empty (php): supportChats
...
0votes
1answer
29views
PHP write a number out of an array
I have a PHP problem.
I need to write a number from a sets of digits 0-9. Each set has 10 digits, each digit once.
I need to count the number of sets that I have to use to write the number.
For ...
-2votes
1answer
26views
php 5.4 vs 7.6 - mysqli doesn't load rows [duplicate]
I've been having an issue migrating from php 5.6 to 7.4.
I am using an old calendar script which I am trying to convert in order to be functional on the new version of PHP.
However when I change the ...
0votes
0answers
7views
does swoole table destroy itself when swoole websocket server shuts down
i am setting up a Swoole web socket server for my chat application on CentOS 7 host machine. and will use Swoole table for storing users list.
But i am not sure what is the lifespan like for Swoole ...
-3votes
0answers
24views
if result is negative or smaller than 0 [closed]
in my database i want to use -1 (true) 0,1,2,3,4,5,6,etc. (false) , how to make it if result is -1 to be true?
<?php if(test()) { ?>
B is OK
<?php } else { ?>
B is NOT OK
<?php ...
0votes
1answer
10views
Laravel - save model to $existing variable to check is field has been updated?
I'm trying to store a model instance to a variable to be able to store the existing values like so:
$meal_booking = MealBooking::where('date', $date)
->first();
$...
0votes
0answers
14views
PHP Return Array from API
I have a code like this. Me need to [Return] because [Echo] is not outputting the code in the right place html. But I can't understand how I can do it through [List] or Return array ()
I tried writing ...
1vote
1answer
14views
Make sessions last until browser closes PHP
I'm working on cpanel Linux Godaddy hosting, I don't have access to php.ini
I've created .user.ini
Worked fine for changing settings, I have the values and as I upload a change, configuration changes ...
-1votes
0answers
15views
Prompt to enter password or wrong email and password format not working (php)
I've been following along with this video https://www.udemy.com/course/create-a-high-end-social-network-like-twitter-in-php-mysql/learn/lecture/7419006#overview to be able to learn the process it ...
0votes
1answer
14views
How to pass a GeoJSON formatted array of longitude and latitude locations from php to javascript to create an Openlayers 6 map?
My php script successfully extracts data from a mysql database and creates a properly formatted and validated geojson array. But I can't figure out how to pass that array directly to the javascript.
...
-2votes
1answer
18views
I am trying to add this code to my website but its not working [closed]
whats wrong with my code, I am trying to add this code to my website
<form method="post" action=<?php $visitor_email = $_POST['email']; $email_from = 'abdelhadi81x@gmail.com'; $...
-1votes
0answers
7views
Redirect using htacess
Can someone help me with this one? My website pages ends with .PHP extension. I am trying to remove .PHP extension with 301 redirect
First rule to remove PHP extension and second for SEOs. But it's ...
-1votes
0answers
10views
Fail install composer google api
I have a probleme since 7 days now. I would like to install the google api with composer, but when i trying ti install it, i have lots of error :
./composer.json has been created
Running composer ...
0votes
4answers
25views
How do I fetch data from a public API on form submit using vanilla JS
I am building a simple webpage where the user can enter a year in a text field and be presented with a list of F1 races for that year.
I am getting my data from this public API: http://ergast.com/mrd/ ...
0votes
0answers
5views
Call to undefined function new\Illuminate\Support\HtmlString()
I am using Laravel blade component for the PDF layout.
Using this {{new \Illuminate\Support\HtmlString(vsprintf(text('Hello %s'),[$user->name])) }}function inside my HTML code to render my html, ...
1vote
1answer
16views
php why does TRUE == "expired"?
This drove me nuts for a few hours.
I have a function returning one of the three following values:
function checkValid() {
...
return array("expired",$oldDate,$newDate) ;
return ...
1vote
0answers
24views
Get password authentication failed after update Laravel to version 9
Previously I had a Laravel app with Laravel 5.7, and now I updated my app to newest Laravel 9 version. But I get an error with my pgsql connection password, even though my .env it's still same.
I try ...