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 3394864
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T04:13:16+00:00 2026-05-18T04:13:16+00:00

Since no other topics uses the script I use, I need serious help. I

  • 0

Since no other topics uses the script I use, I need serious help. I am currently working on a work project and my search feature returns the first page correctly but when I click Next 10 it does absolutely nothing!
Please note I removed some code but left useless comments in, though that wont affect the performance of the script!
Here is my code but ofcourse I have filtered the username and password:
<

<?php

  // Get the search variable from URL

  $var = @$_GET['q'] ;
  $error = $_GET['error'];
  $permnull = @$_GET['nullpermitted'] ;
  $AdminorSuper = "";
  $trimmed = trim($var); //trim whitespace from the stored variable


if(!$session->isSuperuser()){
 $AdminorSuper = "Admin";
}

else
{
 $AdminorSuper = "";
}
// rows to return
$limit=10; 

if($error=="errdel")
{
 echo "<p>Only Admins and Superusers may delete customers. </p>";
}
if($error=="errcret")
{
 echo "<p>Only Admins and Superusers may create customers. </p>";
}
// check for a search parameter
if (!isset($var))
  {
  echo "<p>We dont seem to have a search parameter!</p>";
  exit;
  }

//connect to your database ** EDIT REQUIRED HERE **
mysql_connect("*FILTERED*","*FILTERED*","*FILTERED*"); //(host, username, password)


mysql_select_db("*FILTERED*") or die("Unable to select database"); 

// Build SQL Query  
$query = "select * from customer where Surname OR TitleName OR PostCode like \"%$trimmed%\"  
  order by Surname"; 

 $numresults=mysql_query($query);
 $numrows=mysql_num_rows($numresults);



if ($numrows == 0)
  {
  if($trimmed=="")
  {
  echo "No customers are in the database!";
  }
  else
  {
  echo "<h2>Results</h2>";
  echo "<p>Sorry! No Results were found for: &quot;" . $trimmed . "&quot;.</p>";
  }
  }

// next determine if s has been passed to script, if not use 0
  if (empty($s)) {
  $s=0;
  }

// get results
  $query .= " limit $s,$limit";
  $result = mysql_query($query) or die("Couldn't execute query");

// display what the person searched for
if($var=="")
{
 echo "<p>Viewing all Results</p>";
}
else
{
echo "<p>Results for: &quot;" . $var . "&quot;</p>";
}
// begin to show results set
echo "";
$count = 1 + $s ;

// now you can display the results returned
  echo '<table border="1">';
  echo "<tr><td><b>Surname</b></td><td><b>Title/Name</b></td><td><b>Email</b></td><td><b>Telephone</b></td><td><b>Edit</b></td><td><b>Del</b></td></tr>\n";
  while ($row= mysql_fetch_array($result)) {
  $Surname = $row["Surname"];
  $Title = $row["TitleName"];
  $Email = $row["Email"];
  $Telephone = $row["Telephone"];
  $id = $row["id"];
  echo '<tr><td>' .$Surname.'</td><td>'.$Title.'</td><td>'.$Email.'</td><td>'.$Telephone.'</td><td>' . '<a href="updateCustomerForm' . $AdminorSuper. '.php?id='.$id.'">[EDIT]</a></td>'.'<td>'. '<a href="deleteCustomer.php?id='.$id.'">[x]</a></td>'. '</tr>';
  $count++ ;
  }

$currPage = (($s/$limit) + 1);

//break before paging
  echo "<br />";

  // next we need to do the links to other results
  if ($s>=1) { // bypass PREV link if s is 0
  $prevs=($s-$limit);
  print "&nbsp;<a href=\"$PHP_SELF?s=$prevs&q=$var\">&lt;&lt; 
  Prev 10</a>&nbsp&nbsp;";
  }

// calculate number of pages needing links
  $pages=intval($numrows/$limit);

// $pages now contains int of pages needed unless there is a remainder from division

  if ($numrows%$limit) {
  // has remainder so add one page
  $pages++;
  }
echo "</table>";
// check to see if last page
  if (!((($s+$limit)/$limit)==$pages) && $pages!=1) {

  // not last page so give NEXT link
  $news=$s+$limit;

  echo "&nbsp;<a href=\"$PHP_SELF?s=$news&q=$var\">Next 10 &gt;&gt;</a>";
  }

$a = $s + ($limit) ;
  if ($a > $numrows) { $a = $numrows ; }
  $b = $s + 1 ;
  echo "<p>Showing results $b to $a of $numrows</p>";

?>
  • 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-18T04:13:16+00:00Added an answer on May 18, 2026 at 4:13 am

    It seems that the code missing $s=$_GET['s'];

    Good Luck 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Since enumeration uses integers, what other structure can I use to give me enum-like
I want a Python object that will monitor whether other objects have changed since
newbie for clearcase. Since clearcase's config is rather different from other concept in git,
I opened up Business Intelligence Design Studio (BIDS) the other day. Since then my
Since now I have only used plugin for editing and the way I use
In other topics I've found that IE/FF doesn't print background images by default .
I'm working in a windows environment (my laptop!) and I need a couple of
I am currently working on a .Net application which makes HTTP requests to some
I often need to load other javascript files via ajax, so at the beginning
I am currently taking a course that gives an introduction to project planning. It

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.