How to generate a html page dynamically using PHP?

How to generate a html page dynamically using PHP – Building a Dynamic Web App using PHP & MySQL – A dynamic website is a site that contains dynamic pages such as templates, contents, scripts etc.

How to generate a html page dynamically using PHP

First of all You need to install MySQL & PHP, Create databases, users, and tables in MySQL and create the database connection in PHP and then Start creating folder structure.

Creating Dynamic Web Sites with PHP and MySQL

Creating Dynamic Pages with php and MySQL


require_once "config.php";

$sql_query = $conn->query("SELECT * FROM members ORDER BY memId");

if ($sql_query->num_rows > 0) {
// output data of each row
while($row = $sql_query->fetch_assoc()) {

echo "<tr><td><a href='index.php?member_id=".$row["member_id"]."&memId=".$row["memId"]."'>" .$row["members"]. "</a></td></tr>";
} else {
echo "0 results";


<script type="text/javascript">

        var start = 0;
        var limit = 20;
        var finalItemLim = false;
        var midnew = <?php echo $_POST("memId"); ?>

        $(window).scroll(function () {
            if ($(window).scrollTop() == $(document).height() - $(window).height() )


        $(document).ready(function () {

        function getData() {
            if (finalItemLim)

               url: 'data.php',
               method: 'POST',
                dataType: 'text',
               data: {
                   getData: 1,
                   start: start,
                   limit: limit,
                   midnew: midnew,
               success: function(response) {
                    if (response == "finalItemLim")
                        finalItemLim = true;
                    else {
                        start += limit;

Don’t Miss : Create Dynamic Web Pages Using PHP-MYSQL

Also Read This πŸ‘‰   Simple Get Category ID using Category Name



if (isset($_POST['getData']) ) {

    $conn = new mysqli('localhost', 'root', '[email protected]', 'pakainfo_v41');

    $midnew = $conn->real_escape_string($_POST['midnew']);
    $start = $conn->real_escape_string($_POST['start']);
    $limit = $conn->real_escape_string($_POST['limit']);

    $sql = $conn->query("SELECT * FROM pakainfo_v1 WHERE memId='$midnew' ORDER BY kayit_no DESC LIMIT $start, $limit");
    if ($sql->num_rows > 0) {
        $response = "";

        while($row_result = $sql->fetch_array()) {
            $response .= '

           <td><img src="medias/'.$row_result['kay_board'].'" border="2" width="300px" /></td>


    } else


I hope you get an idea about How to generate a html page dynamically using PHP.
I would like to have feedback on my blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.