I have this code that print the text from the column. I have stored the text in the homework table in the goal column.
I want to print each line of my text inside the list. When I try this code it prints the whole text in a single line of the list.
Is there any way to do this? I was thinking something like regex and split the text every time it has . or \n.
<?PHP
$query = "SELECT * FROM homework";
$result = mysqli_query($conn, $query);
if (mysqli_num_rows($result) > 0) {
while ($row = mysqli_fetch_assoc($result)) {
?>
<h2> <?php echo $row['title']?></h2>
<p class="paragraph">
Goals: The Goals are</p>
<ol >
<li> <?php echo $row['goal']?></li>
</ol>
<?PHP
}
}
?>
For example: inside the homework table, and more specifically my goal column has this text:
"Learn the basic Java skills required to apply for Java Developer Positions. Be able to see your understanding of Java to future employers. Learn the industry's "best practices" in Java software development."
this text is stored inside the $row['goal'] variable so the way is printed it is:
"1. Learn the basic Java skills required to apply for Java Developer Positions. Be able to see your understanding of Java to future employers. Learn the industry's "best practices" in Java software development.
That text I want to be print like this:
- Learn the basic Java skills required to apply for Java Developer Positions.
- Be able to see your understanding of Java to future employers.
- Learn the industry's "best practices" in Java software development.
My data type of database is text. Maybe I should use a different type?