How can PHP be used to prevent line breaks from being stored in a database along with text input?

When storing text input in a database using PHP, line breaks can be prevented from being stored by using the `nl2br()` function to convert line breaks to `<br>` tags before inserting the text into the database. This ensures that the line breaks are displayed properly when the text is retrieved from the database and displayed on a webpage.

// Assuming $text_input contains the text input with line breaks
$clean_text = nl2br($text_input);

// Insert $clean_text into the database
// Example query: INSERT INTO table_name (column_name) VALUES (&#039;$clean_text&#039;);