Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7435677
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:06:54+00:00 2026-05-29T10:06:54+00:00

my problem:— This is my wifi_log.php file <?php // find out how many rows

  • 0

my problem:—enter image description here

This is my wifi_log.php file

    <?php // find out how many rows are in the table 
$sql = "SELECT COUNT(*) FROM log_wifi";
$result = mysql_query($sql, $conn) or trigger_error("SQL", E_USER_ERROR);
$r = mysql_fetch_row($result);
$numrows = $r[0];

// number of rows to show per page
$rowsperpage = 10;
// find out total pages
$totalpages = ceil($numrows / $rowsperpage);
echo $resultpage= $_GET['results_page'];
// get the current page or set a default
if (isset($_GET['currentpage']) && is_numeric($_GET['currentpage'])) {
   // cast var as int
   $currentpage = (int) $_GET['currentpage'];
} else {
   // default page num
   $currentpage = 1;
} // end if


// if current page is greater than total pages...
if ($currentpage > $totalpages) {
   // set current page to last page
   $currentpage = $totalpages;
} // end if

// if current page is less than first page...
if ($currentpage < 1) {
   // set current page to first page
   $currentpage = 1;
} // end if

// the offset of the list, based on current page 
$offset = ($currentpage - 1) * $rowsperpage;

// get the info from the db 
$sql = "SELECT * FROM log_wifi LIMIT $offset, $rowsperpage";
$result = mysql_query($sql, $conn) or trigger_error("SQL", E_USER_ERROR);
?>

My data displaying here:=

<?php

 //while there are rows to be fetched...
while ($row = mysql_fetch_assoc($result))
 {
   ?>
    <td><?php echo $row['id']?></td>
    <td><?php echo $row['user_id']?></td>                                       
    <td><?php echo $row['imei']?></td>
    <td><?php echo $row['time_stamp']?></td>
    <td><?php echo $row['sending_time']?></td>
    <td><?php echo $row['RSSI']?></td>
    <td><?php echo $row['BSSID']?></td>
    <td><?php echo $row['SSID']?></td>
    <td><?php echo $row['sleep_time_start']?></td>
    <td><?php echo $row['sleep_time_end']?></td>
    </tr>           
   <?php
} //// end while
?>

Here is my pagination like FIRST << 1 2 3 >> LAST–>this is working properly

<tr><th id="footer" colspan="10">

    <?php 
    /******  build the pagination links ******/
// range of num links to show
$range = 3;
if($currentpage==1)
{
    echo '<span class="prn">  First &lt;&lt;</span>&nbsp;';
} 
if ($currentpage > 1) {
   // show << link to go back to page 1
   echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=1&result_page=$resultpage'>First</a> ";
   // get previous page num
   $prevpage = $currentpage - 1;
   // show < link to go back to 1 page
   echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=$prevpage&result_page=$resultpage'><</a> ";
} // end if 

// loop to show links to range of pages around current page
for ($x = ($currentpage - $range); $x < (($currentpage + $range) + 1); $x++) {
   // if it's a valid page number...
   if (($x > 0) && ($x <= $totalpages)) {
      // if we're on current page...
      if ($x == $currentpage) {
         // 'highlight' it but don't make a link
         echo " <b>$x</b> ";
      // if not current page...
      } else {
         // make it a link
         echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=$x&result_page=$resultpage'>$x</a> ";
      } // end else
   } // end if 
} // end for

// if not on last page, show forward and last page links        
if ($currentpage != $totalpages) {
   // get next page
   $nextpage = $currentpage + 1;
    // echo forward link for next page 
   echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=$nextpage&result_page=$resultpage'>></a> ";
   // echo forward link for lastpage
   echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=$totalpages&result_page=$resultpage'>Last</a> ";
} // end if
else
{
    echo '<span class="prn"> Last &gt;&gt;</span>&nbsp;';
}
/****** end build pagination links ******/

?>

Problem is here how to do that i know

<form action="./wifi_log.php" method="get">
   <select name="results_page" id="results_page" onchange="this.form.submit();" >
        <option value="5" NO >5</option>
        <option value="10" SELECTED >10</option>
        <option value="20" NO>20</option>
        <option value="50" NO >50</option>
    </select>       
     results per page
</form></th>
    </tr>
    </tbody>
</table>            

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T10:06:55+00:00Added an answer on May 29, 2026 at 10:06 am

    You already have a variable there that does the job. You only need to fill it from the $_POST variable you are sending.

    // number of rows to show per page
    if(isset($_GET['results_page']) && is_numeric($_GET['results_page']))
    {
        $rowsperpage = (int)$_GET['results_page'];
    }
    else
    {
        $rowsperpage = 10;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Problem: Given a list of strings, find the substring which, if subtracted from the
Problem! I Have the following input (rules) from a flat file (talking about numeric
Problem: I call a PHP file using an HTTPService. I set the result of
Problem: find ids that are in one file but not in another. Each file
Problem: Find people whose birthdays are tomorrow (table a), who havent got a record
Problem: I have an address field from an Access database which has been converted
Problem: We have a web app that calls some web services asynchronously (from the
PROBLEM: Here's the code: import matplotlib.pyplot as plt plt.bar([1,2],[5,4]) plt.title('this is a very long
Problem PHP session in different folder. I have problem with PHP session. There are
Problem: Visitors open the url website.com/?i=133r534|213213|12312312 but this url isn't valid anymore and they

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.