I have a quiz database in MySQL where both problem statement and solution (as correct_sol) are stored as text with utf8_general_ci collation. My problem is whenever I recall this information, the results don't have any line breaks. I am using the following code:
$quiz_solution = $wpdb->get_results("query");
foreach($quiz_solution as $item){
$returnVal .= "Solution: $item->correct_sol <br>";
}
return $returnVal;
Not sure if getting the results as an Array is causing the problem.
nl2br<br>'s?\n's?\r's?