When I try to echo data from database using php my html page breaked
691
I want to make a dynamic page but when I try to echo fetched data in HTML using echo between HTML tags the page structure breaks:
This image is with php code :
This is image without php code :
<div >
<div >
<?php while($data = mysqli_fetch_assoc($result)): ?>
<h1 >
<?php
$about = $data['content'];
$about_intro = explode("India",$about);
echo $about_intro[0];
?>
</h1>
<!-- <input type="submit" value="Tell Me More"> -->
</div>
</div>
<?php endwhile; ?>
Answer
Solution:
Close the while loop inside the
div
: