What is the potential issue with the SQL query in the PHP code provided?

The potential issue with the SQL query in the PHP code is that it is vulnerable to SQL injection attacks. This is because the user input is directly concatenated into the query string without any sanitization or validation. To solve this issue, you should use prepared statements with parameterized queries to securely handle user input.

// Fix for SQL injection vulnerability
$pdo = new PDO("mysql:host=localhost;dbname=myDB", "username", "password");

// Prepare a statement
$stmt = $pdo->prepare("SELECT * FROM users WHERE username = :username");

// Bind parameters
$stmt->bindParam(':username', $_POST['username']);

// Execute the statement
$stmt->execute();

// Fetch the results
$results = $stmt->fetchAll();

// Process the results as needed