Skip to main content
Share Your Experience: Take the 2024 Developer Survey

Questions tagged [php]

Use ONLY if PHP is directly relevant to the question and likely to be the source of your problem, not just because you're using a PHP library to connect to a database. PHP stands for Professional Hypertext Preprocessor, a widely used platform for dynamic web applications. If you have a general programming question about PHP, please ask it on Stack Overflow instead.

Filter by
Sorted by
Tagged with
0 votes
0 answers
18 views

Random MySql client error "got an error writing communication packets"

I have several different Linux servers running MySQL 8.0.x instances (ranging from 8.0.23 to 8.0.33). I occasionally get "error writing communication packets" from clients when connecting to ...
Alberto Pastore's user avatar
-2 votes
0 answers
17 views

Getting Rquest has been Truncated error while uploading audio files using php

I am getting "request has been truncated" error when I upload 3 audios of 50MB each using php. Below are some of the variables which I have already set in the php.ini file : ...
Vishal's user avatar
  • 1
0 votes
0 answers
75 views

Recurring Server Downtime Issues with PHP MySQL Website [closed]

I've been encountering recurring server downtime issues with my PHP MySQL website for several months now, and despite having access to WHM and reviewing logs, I'm struggling to pinpoint the root cause....
Abdul Rehman's user avatar
0 votes
0 answers
42 views

MAMP PRO 6.9, PHP 8.2.0, Mac 14.21 and Mongo DB - Apache Fails

Have been trying to get MongoDB installed on MAMP PRO 6.9, PHP 8.2.0, Mac 14.21 via PECL but after a successful install and enabling the extension, when restarting MAMP Pro, Apache fails and none of ...
Nigel McLaughlin's user avatar
-1 votes
1 answer
45 views

Embedding PHP variable into Sqlite statement

I have been struggling with this for hours. I am pretty new to Sqlite and have been trying to write a prepared statement, everything works up until I try to get my variable in. The following works as ...
Fintan Creaven's user avatar
1 vote
1 answer
84 views

Optimize MariaDB for Drupal 10 to handle more users [closed]

I have problems with my Drupal 10/MariaDB 10.5/PHP 8.1 website when they are 20 users simultaniously. The website goes down and the response time is really big (up to 30seconds sometimes) because php-...
mt.i.1's user avatar
  • 11
0 votes
0 answers
10 views

$mysqli->change_user returns Access denied NO password

PHP 8.2.14 MySQL 5.7.23-23 - Percona Server (GPL), Release 23, Revision 500fcf5 This is on a shared webhost with CPanel. I'm importing this test script on page load... $conn = new mysqli("...
chillywilly's user avatar
1 vote
1 answer
48 views

how to speed up and optimize mysql search with indexes

I need to optimize performance on a search with lots of strings like Z1719121. my table structure: codfabrica => varchar 191 => nullable codoriginal => varchar 191 => nullable aplicacao ...
anderlaini's user avatar
0 votes
0 answers
76 views

Simple update query slow in php, quick in phpmyadmin

I have a very interesting issue. A super simple update takes about 400 ms. The website server waiting (TTFB) is usually around 150 ms, but with this update included it becomes 600 ms. mysqli_query($...
Phoenixy's user avatar
1 vote
2 answers
359 views

PosgtreSQL — Is it possible to specify a sequence name in a GENERATED BY DEFAULT AS IDENTITY column?

When using PHP’s lastInsertId() method with PostgreSQL, it’s necessary to know the name of the sequence. If I defined the column using GENERATED BY DEFAULT AS IDENTITY, I know I can get the sequence ...
Manngo's user avatar
  • 2,839
0 votes
0 answers
233 views

Trying to import large sql file in MySQL fails

I am trying to import an SQL file that is 685MB into MySQL. First I tried it through phpmyadmin - it failed. Then I tried through the command line with: mysql -u root -p database-name < file.sql ...
Petar Vasilev's user avatar
0 votes
0 answers
809 views

"The mysqli extension is missing" Tried everything but still no fix!

I recently upgraded to php 8.2.7. Everything was fine until I checked phpmyadmin and got the mysqli extention is missing. I edited the php.ini file in /etc/php/8.2/apache2 directory and added the ...
mani-hash's user avatar
  • 101
0 votes
1 answer
182 views

Transaction/For update lock for an eCommerce project

When users want to purchase their orders, The quantity of the products should be decreased. Now I'm planning to use a Transaction and a FOR UPDATE lock on the products and decrease the quantity of ...
Jacqueline's user avatar
0 votes
0 answers
58 views

What is the best way to get posts with comments from MariaDB?

I have a MariaDB DB with three tables: posts ID | title | content | author_id | likes_count -------------------------------------------------- 1 | Abcd | content_01 | 1 |...
Elgameel's user avatar
0 votes
1 answer
564 views

How to import CSV files into MariaDB in a secure and performant way?

We have a PHP based web application that allows the upload of CSV files. These CSV files with up to 2.5 million rows are to be imported into a table in a MariaDB. How can we make this import secure ...
Ste2play's user avatar
1 vote
0 answers
52 views

Issue with hash storage resulting from password_verify() output

Consider the following code: $random_token = random_bytes(32); $token_hash = password_hash( $random_token, PASSWORD_DEFAULT ); $token_base64 = sodium_bin2base64( $random_token, ...
DevelJoe's user avatar
  • 163
0 votes
1 answer
67 views

Insert rows in 3 tables in a single query, SQL SERVER 2008

I need to insert data into 3 tables in a single query Table SkillData UserIndex SkillPoint TotalSkill 1 5202 99 Table Emblems UserIndex CountEmblem Status 1 1265 1 Table Rewards UserIndex Level ...
Ichigo Kurosaki's user avatar
1 vote
1 answer
77 views

Delete records in different tables

I need to delete the records where UserIndex = 1 and ItemNumber = 5202 in all three tables, all in a single query. I am using SQL 2008 R2. Table UserInfo1 UserIndex Itemnumber ItemCount 1 5202 99 1 ...
Ichigo Kurosaki's user avatar
0 votes
0 answers
41 views

Mariadb / Mysql "Authentication switch request" slows down PHP connections to mariadb server

We switched our on premises MariaDB server to the Azure MariaDB managed service. It runs on MariaDB 10.3.23 in which we cannot tune all server values. While stress testing our PHP API application, we ...
Alex T.'s user avatar
-1 votes
1 answer
1k views

Retrieve all data from an inner join with duplicate column names in MySQL

I have a database with tables for "users" and "profiles". Every profile links back to a user. I would like to do an inner join where I am able to retrieve a set of profiles that ...
Eric Johnson's user avatar
5 votes
2 answers
432 views

Is it secure to have database login in a PHP file? Other options?

I'm a DB and SQL beginner. I'm putting together a basic PHP app that has a few SQL queries. In all my searching and learning, every example accessed the database by first logging in. Makes sense, but ...
user1934286's user avatar
0 votes
1 answer
53 views

Developing database for powerplant-- HELP!

I am network admin at a municipality that has been tasked with creating a database to log information from our powerplant. I know I don’t have the skills to do this, but since I have some knowledge on ...
cloudd2's user avatar
0 votes
1 answer
81 views

Is replication on by default on MySQL 8.0.30 ? How to stop it?

I am running MySQL 8.0.30 on Rocky Linux 9. While importing some ~100GB sql files, I noticed the /var/lib/mysql is filled with binlog.000123 files, over 100GB. I assume these are created because ...
adrianTNT's user avatar
  • 195
0 votes
1 answer
321 views

Unable to connect to server following phpMyAdmin upgrade from 5.1 to 5.2

Not sure to post on the right StackExchange forum. If not, let me know! Working environment: OpenSUSE Leap 15.4 MariaDB : mariadb Ver 15.1 Distrib 10.7.7-MariaDB PHP 8.0.25 (cli) (built: Oct 31 2022 ...
wiltomap's user avatar
  • 317
0 votes
1 answer
306 views

mysqli_fetch_array exceeds memory

I a running a relatively simple query: SELECT gb2_designs.indx, gb2_designs.response_required, gb2_designs.user_design_name, ...
rob boudrie's user avatar
0 votes
2 answers
5k views

how do I select all records that have an event datetime within 1 hour before

how do I select all records that have an event datetime within 1 hour before, for example mysql select all that time_diff less than 1 hour from datetime? its for a reminder email i want to make on a ...
uk_user2014's user avatar
0 votes
1 answer
79 views

How to UNPIVOT an aliased query result using PHP and MySql

I would be grateful for your assistance in helping me get solution for my project weather query problem. I have arrived at the query below and is working: "); $first_row = true; while ($row = ...
BenGik's user avatar
  • 13
1 vote
2 answers
496 views

Table Aliases: MySQL says table R1 does not exist when Joining the same table 3 times

I have a table R with the following fields stated below: weatherID, dateRecorded, Days, locationID, timeRecorded, rainAmount, rainNumberHours, temperature, windSpeed, windDirection NB: The ...
BenGik's user avatar
  • 13
0 votes
1 answer
79 views

How to get mysqli to read a mysql cnf file

From the command line, one can get mysql and mysqldump to read a config file using --defaults-extra-file. This can contain username and password for connection. Is there a way to get mysqli from php ...
Rohit Gupta's user avatar
  • 1,670
0 votes
0 answers
273 views

Unknown column od.id_warehouse in where clause

SELECT LEFT(invoice_date, 10) as fix_date, COUNT(*) as countOrders, SUM((SELECT SUM(od.product_quantity) FROM ps_order_detail od WHERE o.id_order = od.id_order)) as countProducts, ...
Ahmed Ibrahim's user avatar
0 votes
2 answers
1k views

Mysql UUID function, does it prevent duplicates?

lets say i use INSERT INTO database(column1) VALUES (uuid()); if i do the same again INSERT INTO database(column1) VALUES (uuid()); (lets assume the UUIDs are both the same, somehow) will mysql ...
user655355's user avatar
0 votes
0 answers
142 views

Behavior Transactions PDO::beginTransaction() and "BEGIN"

I have a strange behavior in a php script (PHP 8.1) using MariaDB 10.7.5 database. This one with native SQL works: $pdo->query("BEGIN"); [ ... some database stuff ... ] $pdo->query(&...
Marco's user avatar
  • 97
-4 votes
2 answers
48 views

How do I write the query to get the exact result

I am confused about writing query in PHP, I want to: 1. SELECT RollNumber FROM student WHERE ProgramID= ? 2. SELECT DSID FROM datesheet WHERE CourseCode = ? 3. INSERT INTO result (DSID, RollNumber) ...
Ahmed Raza's user avatar
2 votes
1 answer
497 views

Optimize a query multiple tables & Multiple conditions

I need to optimize the query which has multiple joins. And also with multiple OR AND conditions which varies depending upon the user input. The query which gets generated is: SELECT emp.name as ...
Parikshit Bharadwaj's user avatar
0 votes
1 answer
236 views

Understanding slow queries from mysqldumpslow

I'm maintaining a system which sporadically (no exact time) but only at night causes the entire server to crash for a few seconds and the users seeing "Error Connection Refused" until the ...
Marcus Christiansen's user avatar
0 votes
2 answers
915 views

is it possible to list each category as a heading and its own products in a single sql query

i have a DB schema as shown in the picture bellow : i want to view each category and subcategory as a heading and list the products under it note: the products must be of the same supplier like this:...
rh2o's user avatar
  • 1
0 votes
1 answer
722 views

Best approach for basic PHP DB session data storage

I've decided to switch from PHP's native session management based on $_SESSION to use my own, due to many different issues I've had so far with PHP's possibilities, and also because I'm building an ...
DevelJoe's user avatar
  • 163
3 votes
1 answer
1k views

Converting large database with many tables from latin1 to utf8mb4

So this is not a question about "how do I convert a table from latin1 to utf8?" I totally know that and get it. The question I'm trying to ask is, "How can I make this conversion have ...
n0nag0n's user avatar
  • 133
0 votes
2 answers
3k views

How to limit the number of rows in a mysql table

How can I set a limit of rows to a mysql table? (I am using php) POSSIBLE METHOD-1: When the user tries to SIGN-UP I can select everything from the TABLE and get the number of ROWS in the TABLE and ...
user avatar
1 vote
1 answer
366 views

How to deal with invoices that reference products that don't exist any more?

I am developing an ERP using PHP and MYSQL. I have a product page and an invoice page. I am facing an issue, if I delete a product from products page, and I already created an invoice with this ...
Black P's user avatar
  • 11
0 votes
0 answers
58 views

Use of comments to define index relationship to another table

I am building a CRUD system using PHP and MySQL for custom applications I am working on. The question I have relates to the use of comments to define indexes from one table and return the required ...
Majickal's user avatar
0 votes
1 answer
64 views

php mysql aggregating/ combining queries to reduce db connections

I have a use case where a large number of clients are reporting their operational states every minute using an HTTP connection to a php script. For each client, I have a row in a mysql table with ...
aVC's user avatar
  • 101
0 votes
0 answers
266 views

How do I connect to mysql database with password

Using PHP 7.4.27 (now using 7.4.29) with MariaDB in xampp I can access everything using phpmyadmin. I am using the following on my localhost $con = new mysqli($host, $user, $pwd, $db); I can connect ...
Rohit Gupta's user avatar
  • 1,670
5 votes
1 answer
25k views

SQLSTATE[08006] [7] FATAL: the database system is in recovery mode

I have some problem with PostgreSQL and PostGIS. I received an error after running the below query with some coordinates on special raster file. It worked fine until last week. The query is: select (...
mohammad karimi's user avatar
1 vote
0 answers
350 views

Can two simultaneous DB transactions interfere with each other? ACID vs SELECT ... FOR UPDATE?

This question may be considered as a follow-up question to this one. Imagine: a platform that provides a service X to book a service X, customer Y has to pay in advance every payment is authorized ...
DevelJoe's user avatar
  • 163
-1 votes
1 answer
457 views

Mysql takes longer when using php or python compared to worbench queries

Versions: MySQL Community Server: 8.0.16 in Windows server (Configuration file: unknow) Workbench: 8.0 Problem: When I make a query through workbench, it takes 1 second but when I make a query through ...
Ignakal's user avatar
1 vote
2 answers
862 views

Performance of the same MySQL database is different on different servers

I have two servers: Server A: AMD Epyc 7371 - 16c / 32t - 3.1 GHz / 3.8 GHz 256 GB ECC 2400 MHz 2 × 960 GB NVMe SSD MySql 8.0.26 Server B: Dual Intel Xeon Gold 6242R - 20c / 40t - 3.1 GHz / 4.1 GHz ...
Antonio Sordellini's user avatar
2 votes
2 answers
229 views

Does this kind of data/field in this table needs normalization in MYSQL?

I have this uom table in MYSQL: id uom 1 piece 2 dozen 3 set and this products table in MYSQL: id itemNo title uom 1 19421 test1 1:1:10.00,3:1:56.17 2 7878 test2 1:1:24.33 3 123456 test3 2:12:...
Algo's user avatar
  • 31
1 vote
1 answer
2k views

GROUP_CONCAT Extremely slow

I'm trying to use group_concat and join tables using this query. However, it is extremely slow, to the extend which is not possible to apply to production. SELECT a.id, a.`name`, ...
Henry A's user avatar
  • 11
1 vote
0 answers
116 views

Storing Image Filenames As An Array So I Can Add New Values Without Having To Re-Write The Entire Array - MySQL

I have an image library where I would like to create the functionality where users can create boards of selected images. The boards will essentially be collections of images on the site along a ...
pjk_ok's user avatar
  • 111

1
2 3 4 5
14