PHP pagination for desktop and mobile devices -


i want design pagination desktop , mobile devices condition on desktop view want display 3 rows max , in mobile view want display 1 row max per page have following pagination script working static condition want dynamic desktop , mobile. please me , in advance.

php script

<html>     <body>             <div id="content">             <?php                $query1=mysql_connect("localhost","root","");                mysql_select_db("customer_fetcher",$query1);                 $start=0;                $limit=1;                 $id = 1;                 if(isset($_get['id']))                {                    $id=$_get['id'];                    $start=($id-1)*$limit;                }                $query=mysql_query("select * test limit $start, $limit");              echo "<ul>";              while($query2=mysql_fetch_array($query))              {                      echo "<li>".$query2['name']."</li>";              }              echo "</ul>";              $rows=mysql_num_rows(mysql_query("select * test"));              $total=ceil($rows/$limit);              if($id>1)             {               echo "<a href='?id=".($id-1)."' class='button'>previous</a>";             }             if($id!=$total)              {                  echo "<a href='?id=".($id+1)."' class='button'>next</a>";              }               echo "<ul class='page'>";              for($i=1;$i<=$total;$i++)              {                 if($i==$id) { echo "<li class='current'>".$i."</li>"; }                  else { echo "<li><a href='?id=".$i."'>".$i."</a></li>"; }              }              echo "</ul>";      ?>            </div>    </body>    </html> 


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -