What are the potential pitfalls of using functions like dbquery() and dbrows() in PHP for database operations?

Using functions like dbquery() and dbrows() in PHP for database operations can potentially lead to SQL injection vulnerabilities if user input is not properly sanitized. To prevent this, it is important to use prepared statements with parameterized queries to securely interact with the database.

// Example of using prepared statements with parameterized queries
$stmt = $pdo->prepare("SELECT * FROM users WHERE username = :username");
$stmt->bindParam(':username', $username);
$stmt->execute();
$results = $stmt->fetchAll();