dongqiu3709 2017-03-04 14:32
浏览 84

如何使用div动作激活动态表

I have a connection to a database, and have created a dynamic table with Dreamweaver; that all is fine. Now I am trying to make a live search with Java, with the searchbox in the table, and java reuiers to show the data in divs. The results appear on another table, although I didn't write anything inside the div, and my table doesn't change. Now I need to make the actions on the table itself, or to make that table be that div function.

Can someone help me to get the results on the same table or give me an example of how to do it? My code is the following:

<?php require_once('Connections/localhost.php'); ?>
<?php

 mysql_select_db($database_localhost, $localhost);


  if (isset($_POST['Searchbox'])) {
    $search = $_POST['Searchbox'];
     $searchresult = mysql_query("SELECT * FROM members WHERE company LIKE          '%".$search."%' or country LIKE '%".$search."%'or adresse LIKE '%".$search."%'or   prcontact LIKE '%".$search."%'or tel LIKE '%".$search."%'or email LIKE '%".$search."%'or website LIKE '%".$search."%'");
  if (mysql_num_rows($searchresult) > 0){
  while ($searcharray = mysql_fetch_array($searchresult)) {
    $query_members = "SELECT * FROM members WHERE company LIKE '%".$search."%' or country LIKE '%".$search."%'or adresse LIKE '%".$search."%'or prcontact LIKE '%".$search."%'or tel LIKE '%".$search."%'or email LIKE '%".$search."%'or website LIKE '%".$search."%'";
     }
    }
      else {
    $query_members = "SELECT details, company, country, adresse, prcontact,  tel, email, website FROM members";
        }
      }

   $query_limit_members = sprintf("%s LIMIT %d, %d",
       $query_members, $startRow_members, $maxRows_members);
        $members = mysql_query($query_limit_members, $localhost) or die(mysql_error());
    $row_members = mysql_fetch_assoc($members);

   <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
     <script type="text/javascript" > 
     function getSearch(value) {
        $.post("?", {Searchbox:value},function(data) {
            $("#results").html(data) 
        });
   }
       </script>
      <body>


      <table border="1" align="center">
       <tr>
         <td colspan="8"><form action="" method="POST" name="search"><input name="search_box1" type="text" id="search_box1" placeholder="Search" size="100" onkeyup="getSearch(this.value)" formaction="" /></form></td>
        </tr>

      <tr align="center" valign="middle">
        <td><strong>Details</strong></td>
         <td><strong>Company</strong></td>
         <td><strong>Country</strong></td>
         <td><strong>Adress</strong></td>
        <td><strong>PreContact</strong></td>
        <td><strong>Telefon</strong></td>
        <td><strong>E-Mail</strong></td>
          <td><strong>Website</strong></td>
       </tr>
        <tr>
          <td>&nbsp;</td>
<td><form action="" method="POST" name="search"><input type="text" name="search_box2" id="search_box2" formaction="" /></form></td>
<td><form action="" method="POST" name="search"><input type="text" name="search_box3" id="search_box3" formaction="" /></form></td>
<td><form action="" method="POST" name="search"><input type="text" name="search_box4" id="search_box4" formaction="" /></form></td>
<td><form action="" method="POST" name="search"><input type="text" name="search_box5" id="search_box5" formaction="" /></form></td>
<td><form action="" method="POST" name="search"><input type="text" name="search_box6" id="search_box6" formaction="" /></form></td>
<td><form action="" method="POST" name="search"><input type="text" name="search_box7" id="search_box7" formaction="" /></form></td>
<td><form action="" method="POST" name="search"><input type="text" name="search_box8" id="search_box8" formaction="" /></form></td>
</tr>
     <?php do { ?>
     <tr align="center" valign="middle">
      <td><img src="<?php echo $row_members['details']; ?>" width="120" height="32" /></td>
  <td><?php echo $row_members['company']; ?></td>
  <td><?php echo $row_members['country']; ?></td>

    </tr>
   <?php } while ($row_members = mysql_fetch_assoc($members)); ?>
  </table>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
   <div id="results"></div>
      </body>
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 网络设备配置与管理这个该怎么弄
    • ¥20 机器学习能否像多层线性模型一样处理嵌套数据
    • ¥20 西门子S7-Graph,S7-300,梯形图
    • ¥50 用易语言http 访问不了网页
    • ¥50 safari浏览器fetch提交数据后数据丢失问题
    • ¥15 matlab不知道怎么改,求解答!!
    • ¥15 永磁直线电机的电流环pi调不出来
    • ¥15 用stata实现聚类的代码
    • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
    • ¥20 docker里部署springboot项目,访问不到扬声器