我该如何做下一个或预览按钮

时间:2019-01-25 21:47:45

标签: php

我需要有关下一个和预览按钮的帮助,我想使一个按钮向我显示数据的下一个或预览信息,但是我不知道如何,它也必须保留在同一网页中。我的意思是,我有成千上万的数据,而即时消息只显示10,因此下一个botton是刷新并显示接下来的10行信息。这是我的代码:

        <td><table border="2" cellpadding="0">
        <tr>
    <th colspan='9'>Ejemplares</th>
    <tr>
    <td width="150">
    Titular
    </td>
        <td width="150">
    Criador
        </td>
    <td width="125">
    Nombre
    </td>
    <td width="80">
    Chip
    </td>
    <td width="80">
    Estado
    </td>
    <td width="60">
    Capa LG
        </td>
    <td width="50">
    Sexo
    </td>
    <td width="125">
    Grado Generacional
        </td>
    </tr>
    <?php
         $database="caballos"; //database name
         $con = mysqli_connect("127.0.0.1","root" ,"",$database)        
     or die('Could not connect to database server ');
         $query = "SELECT * FROM caballo";
         $result = mysqli_query($con,$query);
         $nfilas = mysqli_num_rows ($result);
    for ($i=0; $i<$nfilas; $i++)
        {
        $resultado = mysqli_fetch_array ($result);
        print ("<TR>\n");
        print ("<TD width='150px'>" . $resultado['titular'] . "</TD>\n");
    print ("<TD width='150px'>" . $resultado['criador'] . "</TD>\n");
        print ("<TD width='125px'>" . $resultado['nombre'] . "</TD>\n");
    print ("<TD width='75px'>" . $resultado['chip'] . "</TD>\n");
    print ("<TD width='75px'>" . $resultado['estado'] . "</TD>\n");
    print ("<TD width='150px'>" . $resultado['capalg'] . "</TD>\n");
    print ("<TD width='50px'>" . $resultado['sex'] . "</TD>\n");
        print ("<TD width='150px'>" . $resultado['grado_gen'] . "</TD>\n");
        print ("</TR>\n");
    }

    mysqli_close($con);

     ?>
       </tr>
       </td>
       <tr>
       <td colspan="2">
       <input type="button" value="INGRESAR" onclick= "self.location.href = 'ing_caballos.php'" /></td>
       <td colspan="2">
       <input type="button" value="GENEALOGIA" onclick= "self.location.href = 'genealogia.php'" /></td>
       <td>
       <!--hear goes the next and preview buttons--> 
       </td>
       <td colspan="2">
       <input type="button" value="ELIMINAR" onclick= "self.location.href = 'del_caballo.php'" />
       </td>
       </tr>
       </tr>

1 个答案:

答案 0 :(得分:0)

您正在寻找分页脚本,请尝试 this tutorial