Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/226.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/83.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 基于行号查询多个SlideIn函数_Php_Jquery_Mysql - Fatal编程技术网

Php 基于行号查询多个SlideIn函数

Php 基于行号查询多个SlideIn函数,php,jquery,mysql,Php,Jquery,Mysql,我正在寻找有关在MySQL查询生成的表上创建“更多详细信息”部分的最佳方法的信息,如下所示: <tr> <th>First Name</th> <th>Surname</td> <th>Details</th> </tr> <tr> <td>Joe</td> <td>Blogs</td> <td><a

我正在寻找有关在MySQL查询生成的表上创建“更多详细信息”部分的最佳方法的信息,如下所示:

<tr>
  <th>First Name</th>
  <th>Surname</td>
  <th>Details</th>
</tr>
<tr>
  <td>Joe</td>
  <td>Blogs</td>
  <td><a class="button-1" href="">More Details</td>
</tr>
<tr>
    <th class="hidden_details hidden-1" colspan="3">...insert details...</th>
</tr>

但我对JQuery的了解有限,因此我认为调用代码的唯一方法是使用php创建多个版本。如果有人能为我指明最佳方法的方向,我将不胜感激

检查此代码。它会帮助你的。这里id=“view\u 1”,id=“show\u 1”1是数据库中的动态值

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<table>
    <tr>
  <th>First Name</th>
  <th>Surname</td>
  <th>Details</th>
</tr>
<tr>
  <td>Joe</td>
  <td>Blogs</td>
  <td><a class="button-1" id="view_1" href="javascript:void(0)" onclick="show_details(1)">More Details</td>
</tr>
<tr>
    <th class="hidden_details hidden-1" colspan="3" id="show_1">...insert details...</th>
</tr>

<tr>
  <td>Joe1</td>
  <td>Blogs2</td>
  <td><a class="button-1" id="view_2" href="javascript:void(0)" onclick="show_details(2)">More Details</td>
</tr>
<tr>
    <th class="hidden_details hidden-1" colspan="3" id="show_2">...insert details...</th>
</tr>
</table>

<script type="text/javascript">

    function show_details(id) {
         if ($('#show_'+id).is(':visible')) {
                 $('#view_'+id).text('More Details');
                 $('#show_'+id).hide();                
            } else {
                 $('#view_'+id).text('Hide Details'); 

                 $('#show_'+id).show();               
            } 
    }
</script>
<style type="text/css">
    .hidden_details {
        display: none;
    }
</style>

名字
姓
细节
乔
博客
更多细节
…插入详细信息。。。
Joe1
博客2
更多细节
…插入详细信息。。。
功能显示详细信息(id){
if($('#show'+id).is(':visible')){
$('#视图'+id).text('More Details');
$('#show'+id).hide();
}否则{
$('#视图'+id).text('Hide Details');
$('#show'+id).show();
} 
}
.隐藏的详细信息{
显示:无;
}
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<table>
    <tr>
  <th>First Name</th>
  <th>Surname</td>
  <th>Details</th>
</tr>
<tr>
  <td>Joe</td>
  <td>Blogs</td>
  <td><a class="button-1" id="view_1" href="javascript:void(0)" onclick="show_details(1)">More Details</td>
</tr>
<tr>
    <th class="hidden_details hidden-1" colspan="3" id="show_1">...insert details...</th>
</tr>

<tr>
  <td>Joe1</td>
  <td>Blogs2</td>
  <td><a class="button-1" id="view_2" href="javascript:void(0)" onclick="show_details(2)">More Details</td>
</tr>
<tr>
    <th class="hidden_details hidden-1" colspan="3" id="show_2">...insert details...</th>
</tr>
</table>

<script type="text/javascript">

    function show_details(id) {
         if ($('#show_'+id).is(':visible')) {
                 $('#view_'+id).text('More Details');
                 $('#show_'+id).hide();                
            } else {
                 $('#view_'+id).text('Hide Details'); 

                 $('#show_'+id).show();               
            } 
    }
</script>
<style type="text/css">
    .hidden_details {
        display: none;
    }
</style>