What are the potential pitfalls of storing multiple data in a single column in a PHP database?

Storing multiple data in a single column in a PHP database can make it difficult to query and manipulate the data efficiently. It can also lead to data redundancy and make it challenging to maintain data integrity. To solve this issue, it is recommended to normalize the database by creating separate tables for related data and establishing proper relationships between them.

// Example of creating separate tables for related data

// Table for users
CREATE TABLE users (
    id INT PRIMARY KEY,
    username VARCHAR(50),
    email VARCHAR(100)
);

// Table for user roles
CREATE TABLE user_roles (
    id INT PRIMARY KEY,
    user_id INT,
    role VARCHAR(20),
    FOREIGN KEY (user_id) REFERENCES users(id)
);