When I try to echo data from database using php my html page breaked

Manish Panchal

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 class="col-md-8 col-12">
<div class="intro-text">

    <?php while($data = mysqli_fetch_assoc($result)): ?>

    <h1 class="intro-lead-in" style="margin-top: 116px;">
        <?php 
            $about = $data['content'];
            $about_intro = explode("India",$about);
            echo $about_intro[0];
        ?>
    </h1>
 <!--   <input style="text-align:center;margin-left:88px;color:white;background-color:#f7b733;margin-bottom:20px;margin-top:176px;margin-left:-12px;" class="btn btn-md" type="submit" value="Tell Me More">  -->
</div>
</div>

<?php endwhile; ?>
Saral

Close the while loop inside the div:

<div class="col-md-8 col-12">
<div class="intro-text">

    <?php while($data = mysqli_fetch_assoc($result)): ?>

    <h1 class="intro-lead-in" style="margin-top: 116px;">
        <?php 
            $about = $data['content'];
            $about_intro = explode("India",$about);
            echo $about_intro[0];
        ?>
    </h1>
    <?php endwhile; ?>
 <!--   <input style="text-align:center;margin-left:88px;color:white;background-color:#f7b733;margin-bottom:20px;margin-top:176px;margin-left:-12px;" class="btn btn-md" type="submit" value="Tell Me More">  -->
</div>
</div>

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Display data from a database in a HTML page using django

How can I get all my data from a table in my database and show it using php?

PHP undefined variable when I try to extract data from database

Does it matter if I use PHP or AJX to return formatted html containing data from my database?

Why I get "ECONNRESET" when I try to get an element from a remote html page

Jmeter : Error when I try to get data from Database using beanshell assertion

how can I view the data get from database to my gridview using php?

PHP error message when I try to check a value from database

is my database password exposed when I connect using php?

PHP echo jpeg from MYSQL into an HTML page

How do I append data from a HTML form to a database on a button press? Possibly using PHP?

echo database data to html php pdo

Why do I get an error (Notice: Undefined index) when I try to echo a value from my database?

When I try pause and play in jsFiddle, my code works but it doesn't work in my html page

PHP Exits When I Try to Connect to a Database Using MySQLi

how to make my html part of the page look differently when I login as a user from a different table in database

How Can I Echo This PHP 'Field Required' Message On My HTML Page?

Why I'm not being able to submit my data to my database using JQuery and PHP and why my page keeps redirecting to the home page?

HTML2PDF footer issue on auto breaked page

I want to populate my form elements with data i fetch from my database in another php file using ajax

I found a problem when updating data from PHP to my SQL database I want to update according to student ID

Page updates, when I try to send mail-foem data by using ajax+php

Why my vuex store state chnage when i try to chnage the data using the method in my component?

When I try to echo my header code, the php code to do so is rendered as plain text

How can I display data from MYSQL database using HTML table from a PHP file?

what cause the error , when i'm trying to retreive data from database using PHP

I'm trying to set cookies from a form on page 1 and echo the information to page 2 but page 2 just keeps showing a blank page when i try

App crashes when i try to add data to my database

How come my DotNet Blazor WASM app fails to finish loading when I try to read some data from a local SQL database from WebAppBuilder in "program.cs'?