In PHP development, what are some common pitfalls or best practices to keep in mind when working with multiline text stored in a database?

When working with multiline text stored in a database in PHP, a common pitfall is not properly escaping the text before storing it in the database or when retrieving it. To avoid issues with special characters and SQL injection vulnerabilities, it is best practice to use prepared statements with parameterized queries when interacting with the database.

// Example of using prepared statements to insert multiline text into a database
$stmt = $pdo->prepare("INSERT INTO table_name (multiline_text_column) VALUES (:multiline_text)");
$stmt->bindParam(':multiline_text', $multilineText, PDO::PARAM_STR);
$multilineText = "This is a multiline text\nWith multiple lines";
$stmt->execute();