What are the potential pitfalls of using a primary key for unique usernames in PHP?
Using a primary key for unique usernames in PHP can lead to potential pitfalls such as exposing sensitive information or causing performance issues. To solve this issue, it is recommended to use a separate column specifically for usernames and enforce uniqueness using a unique constraint or index in the database.
CREATE TABLE users (
id INT PRIMARY KEY,
username VARCHAR(50) UNIQUE,
password VARCHAR(255)
);