I'm making my very first full stack project. I made this blog, on which you can post and comment, and all of the posts and comments are stored in a mysqli database.
to get all the data in the database when you load a page, I use php to store all of those datas in an array, and then echo those datas on the web page.
the part where it sets, get and shows the data on the page is fine. But when I echo the data from the array (which gets its data from the database table) the text overflows my div... I tried everything with CSS and bootstrap, it's not working.
I don't know why, I tried many things and I've been stuck on this for the last 2 days.
and forgive me for the bad practices of my code, I'm junior and mostly front-end. This is my first attempt for a full stack project, so I'm learning on my own while coding this.
<?php foreach($datas as $value): ?>
<?php
$id = $value['id'];
echo $id;
$imgSrc = $value['image'];
echo
"<div class='container-fluid' style='text-align: center; padding: 5% '>
<div class='row'>
<h1 id='titlePost' class='col-md-8 mx-auto'>" . $value['title'] . "</h1>".
"<hr class='w-50' style='height: 6px; background-color: #03fc84 !important; margin-left: auto; margin-right: auto;'>".
"
<div class='row col-12'>
<img src='$imgSrc' class='img-fluid col-md-4 mx-auto'>
</div>
<div class='container-fluid'>
<div class='row col-12'>
<p class='col-md-8' >" . $value['description'] . "</p>
</div>
</div>
".
"<p style='color: black; background-color: #03fc84;' class='w-50 mx-auto'>" . $value['date'] . "</p>".
"<div class='container-fluid'>
<div class='row col-md-12'>
<form action='".setComments($conn, $id, $sessionComments)."' method='post' enctype='multipart/form-data' class='col-md-8 mx-auto'>
<input name='comments' type='text' class='form-control' id='exampleFormControlInput1' >
Select image to upload:
<button type='submit' name='commentSubmit$id' id='btnSend' class='w-25 mx-auto btn btn-primary'>Comment
<i class='fas fa-paper-plane' style='font-size: 2.5rem; color : #ff6016; display: inline-block;'></i>
</button>
</form>
".
"
</div>
</div>
</div>
</div>";
// afficher les commentaires
getComments($conn, $commentsArray, $id);
?>
<?php endforeach ?>