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
1 answer
19 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 ...
user avatar
  • 147
3 votes
1 answer
71 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 ...
user avatar
  • 133
0 votes
2 answers
42 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
49 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 ...
user avatar
  • 11
0 votes
0 answers
33 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 ...
user avatar
0 votes
1 answer
31 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 ...
user avatar
  • 101
0 votes
0 answers
27 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 ...
user avatar
0 votes
0 answers
183 views

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

I have some problem with postgresql and postgis. i got error on below query with some coordinates on special raster file. notice that its worked until last week. the error is : SQLSTATE[08006] [7] ...
user avatar
1 vote
0 answers
30 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 ...
user avatar
  • 147
0 votes
0 answers
60 views

Storing hex and random bytes data in MariaDB

For different password verification mechanisms, we use randomly created variables which we have to store within the db, more precisely we use: bin2hex( random_bytes( x ) ) values that we store in ...
user avatar
  • 147
0 votes
1 answer
37 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 ...
user avatar
1 vote
2 answers
177 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 ...
user avatar
2 votes
2 answers
149 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:...
user avatar
  • 31
1 vote
1 answer
110 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`, ...
user avatar
  • 11
1 vote
0 answers
24 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 ...
user avatar
  • 111
0 votes
0 answers
24 views

Is there a purpose for UPDATE ... WHERE but with same values?

I am translating some code from PHP to Python, and I came upon this interesting snippet: $sql11 = "UPDATE tbl_pas SET api_id_pas='" . $api['kd_pas'] . "' WHERE api_id_pas='&...
user avatar
  • 187
-2 votes
2 answers
43 views

1 table or multiple tables?

I am building a web application (php/mysql). There will potentially be many users (managers). There is a table (let's call it "gurus") into which a manager/user will enter lists of gurus. ...
user avatar
0 votes
1 answer
115 views

Secure MySQL database by encryption?

I have cloud webserver running ubuntu where a MySQL database is installed. The database has a table with sensitive data. To protect the data I would like to encrypt the database (or database content). ...
user avatar
0 votes
2 answers
130 views

Prepared statement looks right but throws error 1064

I've prepared a statement for updating users address. However I am getting error 1064, and I just do not know what could be wrong anymore. I would appreciate help with this. Thanks! Also I am 100% ...
user avatar
0 votes
1 answer
58 views

How to improve performance of a stored procedure called from a web page?

This is my first SQL stored procedure $sql = ("CALL Login_Details($ID);"); $result = mysqli_query($conn, $sql); $row = mysqli_fetch_array($result); mysqli_next_result($conn); When I run ...
user avatar
0 votes
1 answer
101 views

Database schema for marketplace[posts_attributes]

Okay so I am making a marketplace type of website like olx etc.. users can post different types of posts meaning the fields change so I made an extra table called posts_attributes which those changing ...
user avatar
8 votes
1 answer
1k views

What does it mean that PostgreSQL "offers" PHP?

On https://www.enterprisedb.com/downloads/postgres-postgresql-downloads : PostgreSQL runs on all major operating systems, including Linux, UNIX (AIX, BSD, HP-UX, macOS, Solaris), and Windows. It ...
user avatar
0 votes
1 answer
61 views

Column collision in Left join with many columns vs PHPMyAdmin resultset

I have 4 tables (75 columns each table approx) but they share columns with the same name: Table Master_Producto Master_Product.PD_Prof_21 Table Product_Structure Product_Structure.PD_Prof_21 I am ...
user avatar
0 votes
2 answers
378 views

MySQL: Why not create an index on every column? What is the cost of indexing a column?

I know I shouldn't have an index on every column, but I don't know WHY. What is the cost? I have a system with about 400 tables, many of which have datetimes or foreign keys (which might not ACTUALLY ...
user avatar
  • 133
1 vote
1 answer
113 views

Intermittent SQLSTATE[HY000] [2003] Can't connect to MySQL server on 'server.here' (110)

I'm suddenly having intermittent 2003 connection errors and I can't find anything that has changed that can explain it. These servers have been running smoothly for years and suddenly two days ago ...
user avatar
  • 111
0 votes
1 answer
56 views

How to speed up queries for 2m Datasets in PHP & Mysql

We have a SaaS Application site, where we would have over 2M records in a table. Server version: 8.0.19 - MySQL Community Server - GPL Protocol version: 10 Even with the indexes these queries are ...
user avatar
-1 votes
1 answer
1k views

How to resolve errno: 150 "Foreign key constraint is incorrectly formed" [closed]

CREATE TABLE `account_transfers` ( `id` bigint unsigned NOT NULL AUTO_INCREMENT, `uuid` char(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, `from_account_id` bigint unsigned ...
user avatar
0 votes
1 answer
72 views

How to count id up in sql? [closed]

I want to create a small quiz and I have all the questions in my sql which kinda looks like this : id question 1 how long...? 2 how many...? I want to start with question with id=1 and after a ...
user avatar
  • 1
-1 votes
1 answer
32 views

Multiple JOINs returning only the last referenced table [closed]

I've columns in different tables referenced in a one table, I'm running a query to fetch the fields related to those columns in their respective tables, but the query is returning only the last join (...
user avatar
  • 1
0 votes
0 answers
31 views

Multiple Data Range Loop Query

How do you do a multiple date range in a query, but loop through and only use data within those time ranges? Example: Multiple Date Range Query WHERE ((BETWEEN '2021-04-10 17:39:45' AND '2021-04-10 17:...
user avatar
  • 45
1 vote
1 answer
246 views

Ubuntu - Sybase - PHP not able to connect

I'm trying to connect Sybase 17 from PHP(7.4, 8.0) Laravel running on apache2 on Ubuntu(18.4) system. We are using SQL Anywhere. Sybase is not installed on the same server. We are getting this error -...
user avatar
  • 115
0 votes
1 answer
19 views

Sync tables with selections

I have a problem that I don't know how I could solve it. I have two tables in two different databases on two servers. Server 1 (Master) has the data and server 2 is the slave. But Server 2 only needs ...
user avatar
0 votes
0 answers
52 views

Generate report by cross join between two tables

I wanted to generate report between two tables by using CROSS JOIN. Below shows the details of table. Table 1: kod_jawatan jawatan_id jawatan_kod jawatan_nama Table 2: tpermohonan mohon_id ...
user avatar
  • 1
0 votes
0 answers
113 views

How to join these two tables without Foreign Key? [duplicate]

I want to generate monthly report and the total in a year based on position(jawatan) that has been applied. Table 1 : tpermohonan (mohon_id pemohon_id mohon_tarikh mohon_online) mohon_id pemohon_id ...
user avatar
  • 1
0 votes
1 answer
43 views

Why transaction blocking simple insert in MySQL? [closed]

transaction Query mysqli_begin_transaction($conn); $sql = "UPDATE foldertable SET trashed = 1 WHERE serverToken = (SELECT serverToken from servertoken where userToken = ? limit 1) and ...
user avatar
0 votes
0 answers
47 views

mysql binary keyword issue with special characters

Password in database:- !|%$&./()=?ì^ If I use below query:- SELECT * FROM `user` WHERE Password='!|%$&./()=?ì^' AND Status='1' This works fine. But I am checking for case sensitive passwords ...
user avatar
0 votes
1 answer
220 views

Reset Root Password MySQL on Ubuntu

I know there are tons of posts about this on here but nothing seems to work. I have tried every command I could find it will not work. I just recently setup mysql on Ubuntu (SQL version is 8.0.23-...
user avatar
0 votes
0 answers
12 views

Understanding Laravel relationships better

I want to make a simple project to understand better the Laravel database relationships. So I decided to make a movie storage project which is holding some movie names and some informations about that ...
user avatar
1 vote
2 answers
353 views

MySQL how do I priorities single column by multiple keywords

I have a column of product title, I have to order by result by max word's matched from entered string Select Id, tittle, description,....., Case When a.title REGEXP [[:<:]]Men's shoes[[:>:]] ...
user avatar
0 votes
0 answers
16 views

public MAMP mysql database

I am making a database for my family but they live in other places and I run the database so they are on another network. when I try to download data out of my database on my local network it works ...
user avatar
-1 votes
1 answer
26 views

How to get applied stored procedure for inserted row in mysql php query [closed]

$query = "CREATE PROCEDURE IF NOT EXISTS Insertion(IN firstname varchar(40),IN lastname varchar(40),IN email varchar(40),IN department varchar(40),IN doj date,IN basicpay int(11)) BEGIN ...
user avatar
0 votes
1 answer
20 views

How to structure MySQL database tables for users and how to handle adding/removing permissions?

I am making a database structure for users, who can become part of a group, and within that group the admin of the group can assign as many permissions to a user as they would like. This part seems ...
user avatar
0 votes
1 answer
33 views

Getting only 4 rows per idea from ideas table [closed]

i have a table of ideas that stores responses from evaluators and stores as one row per evalautor For ex : Evalautor 1 evaluated idea A then in table record gets added as IDEA A, COMMENTS , EVALUATOR ...
user avatar
1 vote
2 answers
681 views

MySQL too many connections on shared server

We have run a PHP/MySQL blog site on a shared server for years with no problem (my code not Wordpress). I'm not an system or database guy except for what I need. Our host (BlueHost) moved our site to ...
user avatar
  • 31
2 votes
3 answers
138 views

Entering Exact Values into a Table Using SQL

I am needing to insert particular values into a table I am working on with SQL (see function below): INSERT INTO *Table Name* (...) VALUES(...); The values that are going to be stored inside this ...
user avatar
  • 131
0 votes
1 answer
19 views

Join static file xml with ID field with Database table ID field [closed]

I am using php to display a table with different columns. The table is build from a static xml file with several hundreds of entries. Each entry has also an ID field. I have to look up that ID field ...
user avatar
  • 109
2 votes
1 answer
289 views

How to PIVOT data from MSSQL query and Fetch to PHP view

I have a MSSQL 2005 Database with query content like this : nopas code name order 00115301 D031 ADAM 1 00130015 D031 ADAM 2 00149998 D026 JAMES 1 00149970 D028 FIKI 1 00142641 D028 FIKI 2 ...
user avatar
  • 21
0 votes
1 answer
29 views

How to find repeating records effectively?

I have a registration application for registering 6 courses. The program will check the repeated register users first. Those users that needed to be checked comes from last year. If users registered ...
user avatar
  • 1
1 vote
0 answers
216 views

How to Sync and Consolidate Data from Multiple MYSQL local database to MYSQL live server database in PHP?

What I want to accomplish is that the web app will still work without internet connections, which means that the branch will still operate without internet connections. If there is an internet ...
user avatar
  • 11
-1 votes
2 answers
39 views

Avoid writing duplicate query [closed]

Is there any way to collect somehow or write in another way query's which is repeted couple of times. I have a lot of query which are repeted a couple of times, and I dont know to to avoid this issue....
user avatar

1
2 3 4 5
14