Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7658773
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T13:14:42+00:00 2026-05-31T13:14:42+00:00

I try to show Mysql result as table inside <div> after click submit button,

  • 0

I try to show Mysql result as table inside <div> after click submit button, but it just only show <table></table>. No problem found during posting value to process page.
So far, my script is like:

<form id="myform">
....................
<button id="input" type="button" class="ui-state-default ui-corner-all"><span>Submit </span></button>
<input name="action" value="openreport" type="hidden">
</form>
<div id="show"></div>

$("#submit").click(function(){
      var params=$("#myform").serialize();
      $.ajax({
              type:"post",
              url:"go.php",
              data:params,
              cache :false,
              async :false,
              success : function(result) {
                   $('#show').replaceWith(result);
                   }
              });
      });

page go.php:

     <?php

         //CONNECT TO DATABASE
         $dbc=mysql_connect(_SRV, _ACCID, _PWD) or die(_ERROR15.": ".mysql_error());
         mysql_select_db("qdbase") or die(_ERROR17.": ".mysql_error());

         switch (postVar('action')) {
                 case 'openreport':
                         openreport(postVar('model'),postVar('line'),postVar('lot_no'));
                         break;
                         }

         function openreport($model,$line,$lot_no){
                 $Model = mysql_real_escape_string($model);
                 $Line = mysql_real_escape_string($line);
                 $Lot = mysql_real_escape_string($lot_no);

                 $group=" GROUP BY DATE ";

                 $sql="SELECT Range_sampling,DATE(Inspection_datetime) AS DATE FROM
     inspection_report WHERE Model LIKE '".$Model."'"; 
                     $sql.="AND Line LIKE '".$Line."' AND Lot_no LIKE '".$Lot."'".$group;
                     $result=mysql_query($sql) or die(_ERROR26.": ".mysql_error());

                     echo "<table border='1'>


 <tr>
     <th>Firstname</th>
     <th>Lastname</th>
     </tr>";
     while($row = mysql_fetch_array($result))
       {
     echo("<tr><td>$row[0]</td><td>$row[1]</td></tr>");
     //  echo "<tr>";
     //  echo "<td>" . $row['Range_sampling'] . "</td>";
     //  echo "<td>" . $row['DATE'] . "</td>";
     //  echo "</tr>";
       }
     echo "</table>";

     mysql_close($dbc);
         }
         ?>

I have no idea because I’m not really understand how to show mysql result as a html table.


only show table header

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T13:14:43+00:00Added an answer on May 31, 2026 at 1:14 pm

    The AJAX call is made only if a button is clicked that has an id of “submit”; however, your submit button has an id of “input”. Try changing the line that reads:

    $("#submit").click(function(){

    to

    $("#input").click(function(){

    As Yun suggested, to keep <div id="show">...</div> wrapped around the table, change

    $('#show').replaceWith(result);

    with

    $('#show').html(result);

    I don’t know if this will help or not, but it’s the only thing that stands out to me.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i try to show and hide divs on click but something isnt going wel
I try to color given area of bitmap. After show it on screen. Currently
all I am using Winform(C#) and RDLC MySQL. In that I try to show
I try to use GtktreeView to show results of mysql query in C with
Rather than try describe it, I should just show you. The Korean text is
This compiles: class Ex1 { public int show() { try { int a=10/10; return
iam using setting.bundle and i try to show a hidden picture with Switch toggle
I try to build project in Eclipse on Linux Ubuntu. Eclipse show error message:
When I try to execute my code, I'm getting an error dialog: 'Show Disassembly'
I try to use amazon API using PHP. If I use print_r($parsed_xml->Items->Item->ItemAttributes) it show

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.