Results 1 to 2 of 2

Thread: show mysql result into html table on new window

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    May 2013
    Posts
    1,126

    show mysql result into html table on new window

    I have this main page with text and button.

    On click of the textbox, it should open a new window and show there html table populated with mysql records and on each row has a button that when I click on it, the value of the text on the main page is the some value on the row where I clicked the button.

    I have already googled and checkout youtube samples but no result what I am looking.
    I am a self learning on this and just started reading today about javascript and jquery so I dont fully grasp all the
    information yet.

    I rely on the help about this from the rest of the forum members. Please kindly bear with me asking for help.

    Thanks in advance.

  2. #2
    Lively Member
    Join Date
    Jan 2020
    Posts
    120

    Re: show mysql result into html table on new window

    PHP Code:
    <?php
    $con
    =mysqli_connect("example.com","peter","abc123","my_db");
    // Check connection
    if (mysqli_connect_errno())
    {
    echo 
    "Failed to connect to MySQL: " mysqli_connect_error();
    }

    $result mysqli_query($con,"SELECT * FROM Persons");

    echo 
    "<table border='1'>
    <tr>
    <th>Firstname</th>
    <th>Lastname</th>
    </tr>"
    ;

    while(
    $row mysqli_fetch_array($result))
    {
    echo 
    "<tr>";
    echo 
    "<td>" $row['FirstName'] . "</td>";
    echo 
    "<td>" $row['LastName'] . "</td>";
    echo 
    "</tr>";
    }
    echo 
    "</table>";

    mysqli_close($con);
    ?>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width