Pages

Showing posts with label Mysql TIPS and TRICKS. Show all posts
Showing posts with label Mysql TIPS and TRICKS. Show all posts

Wednesday, January 16, 2019

How to Make your Website PCI DSS Compliant

Web application that need to take payment online, then it has to follow the PCI DSS compliance (Payment Card Industry Data Security Standards). Ensuring that website is secure for taking payment and its not stolen the card data and password by anyone.

There are few point need to implement in application to follow PCI DSS compliance
a). Secure Hosting (Use SSL)
b). Use Latest TLS version of web server
c). Protect Card Data : Use Hosted payment form for any gateway (Not use website payment form)
d). CSRF token use for every request
e). Do not store card data in database : If need to reuse user card information then use token instead of storing card details
f). For reference if storing card data then store in masked format and store only last 4 digit of card number
g). Password Expiration policy
h). Always use strong password encryption algorithm for storing password in DB
i). Prevent XSS in application

Monday, July 2, 2018

MYSQL Comma Seperated Rows | Concatenate multiple MySQL rows into one field

Tips Trick to Concatenate comma separated rows Value:

Suppose you want to show comma separate row value using mysql query and want output like below:

Mysql query to get favorite subject of Person :

SELECT subjects FROM user_subject_table WHERE user_id = 5; 

It will Give below output:

subjects
Computer
History
English
Chemistry

But you want to show comma separate in single row with user id then use below query:

SELECT user_id, GROUP_CONCAT(subjects SEPARATOR ', ') as fav_subject
FROM user_subject_table GROUP BY user_id

Output:

user_id          fav_subject
2                     English, Computer
5                     Computer, History, English, Chemistry

Advance Usage : 
1. Show Distinct subjects

SELECT user_id, GROUP_CONCAT(DISTINCT subjects  SEPARATOR ', ') as fav_subject

FROM user_subject_table GROUP BY user_id

2.  Show Subject Order by (ASC or DESC)

SELECT user_id , GROUP_CONCAT(subjects  ORDER BY subjects  ASC SEPARATOR ', ') as fav_subject FROM user_subject_table GROUP BY user_id