simple Pagging in php

Diposting oleh Algam on Senin, 29 Juli 2013

To pagging actually easy kenapah I say easy hold you all that you want to keep learning ... very easy and simple words are pronounced ....

first you need to prepare a table before ......

CREATE TABLE `students` (

`Nis` INT NOT NULL AUTO_INCREMENT PRIMARY KEY,

`Name` VARCHAR (35) NOT NULL,

`Jk` VARCHAR (1) NOT NULL

) ENGINE = MYISAM;


if the table is already installed with students databse you please fill this table dengam 10 records for pagging check whether or not the road.

and you copy the following script =>

siswa.php name

<table>

      <thead>

        <tr>

     

          <th> nis </ th>

          <th> name </ th>

          <th> jk </ th>

        </ Tr>

      </ Thead>

      <tbody>

      <? Php

Mysql_connect ("localhost", "root", ""); / / local name, the user should, if there is a password on the contents

Mysql_select_db ("school") ;/ / name of the database I use the name of the school databse

                  $ Limit = 10 ;/ / create limits on how much data I use until 10 data

                $ Start = $ _GET ['terms'] * $ limit ;/ / this make take some halamanya

$ Sql ​​= "SELECT * FROM` students `limit $ start, $ limit"; / / select which tables will be displayed

                  $ Qry = mysql_query ($ sql);

                  while ($ data = mysql_fetch_array ($ qry)) {

             

                  ?>

        <tr>

          <td> <? php echo $ DataProduct [0]?> </ td>

          <td> <? php echo $ DataProduct [1]?> </ td>

          <td> <? php echo $ DataProduct [2]?> </ td>

         

       

        </ Tr>

        <? Php

                  }

                                ?>

      </ Tbody>

    </ Table>

    <p align="center"> page: <? php

  Let $ = mysql_query ("SELECT * FROM` students `"); / / reselect which tables will be displayed but must be the same as above

  $ Qty = mysql_num_rows ($ let) ;/ / count the number of data

  $ Result = $ Qty / $ limit ;/ / to know the data

  $ No = 0;

  for ($ number = 0; $ number <$ result, $ number + +) {/ / repeat the data and must not be greater than $ results

                  $ No + +;

                  echo "<a href=\"siswa.php?hal=$angka\" class=\"active\"> $ no </ a>";}

                ?> </ P>

so many of my anchovies may be useful for you thank you ..

Sources MYBLOG  Inspiration Of Dreams

{ 0 komentar... read them below or add one }

Posting Komentar