Hot answers tagged

4 votes
Accepted

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

What I have done for PHP projects is to define the database credentials (or any other credentials, for example web services) in files outside the http document root. In fact, most of your code can and ...
  • 11.7k
1 vote

How to get the most recent result sets when grouping key and date are in separate tables

These indexes should help performance: t1: INDEX(comparison_bool, comparison_bool_2, external_id, table1_id) t2: INDEX(comparison_int, needed_limiting_date, table1_id) To make it more performant, ...
  • 72.7k
1 vote

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

The other common choice is to server a web page, and then the user manually enters the username and password and submits it back through the php script.
  • 141
1 vote
Accepted

how to create an auto-increment column with a prefix in Adminer with MySQL

Do not store a delimited list in column, you will have a lot of pain. Take a read on Is storing a delimited list in a database column really that bad?. As per your requirement , how to create an ...
  • 2,534
1 vote
Accepted

PDO request to loop in a field

You could use: select p.* from ___Products p inner join ( select PRO_LinkedProd from ___Products where PRO_Name ='Banana' ) x on x.PRO_LinkedProd like concat(&...
  • 2,534
1 vote
Accepted

Products variants in EAV

It's because you're using INNER JOINs in your subquery, and you need outer joins, particularly LEFT JOINs instead, so the products list doesn't get filtered there. (You'll also need to move the ...
  • 29.5k
1 vote

MySQL 8: trying to alter two TIMESTAMP tables from NOT NULL to NULL and from '0000-00-00 00:00:00' to NULL as default value

This is an effect of current SESSION sql_mode server setting. You must clear it before your actions and restore after. DEMO SELECT @@sql_mode; SET @old_sql_mode = @@sql_mode; SET SESSION sql_mode = '';...
  • 18.3k
1 vote

mysqldump still fails even with mysqldump --column-statistics=0

As of 2023 I had to make mysqldump work regardless of version both on Linux and MacOS. This little script worked to solve the problem. It just checks if argument --column-statistics=0 fails or not and ...
  • 111

Only top scored, non community-wiki answers of a minimum length are eligible