What are the potential pitfalls of using multiple quotation marks in SQL queries in PHP?

Using multiple quotation marks in SQL queries in PHP can lead to syntax errors or SQL injection vulnerabilities. To avoid this, it is recommended to use prepared statements with parameterized queries. This helps sanitize the input and prevent malicious SQL injection attacks.

// Example of using prepared statements with parameterized queries to avoid SQL injection
$pdo = new PDO("mysql:host=localhost;dbname=myDB", "username", "password");

$stmt = $pdo->prepare("SELECT * FROM users WHERE username = :username");
$stmt->bindParam(':username', $username, PDO::PARAM_STR);
$stmt->execute();

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