What is the potential issue with using non-numerical indexes in arrays when including variables in SQL queries in PHP?

Using non-numerical indexes in arrays when including variables in SQL queries in PHP can lead to SQL injection vulnerabilities. To prevent this issue, it is recommended to use prepared statements with placeholders for variables in the SQL query. This way, the variables are automatically escaped and sanitized by the database driver, making it safe from SQL injection attacks.

// Using prepared statements to prevent SQL injection
$pdo = new PDO("mysql:host=localhost;dbname=mydatabase", "username", "password");
$stmt = $pdo->prepare("SELECT * FROM users WHERE username = :username");
$stmt->bindParam(':username', $username);
$stmt->execute();
$result = $stmt->fetchAll();