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

  • Home
  • SEARCH
  • 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 771911
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T18:43:42+00:00 2026-05-14T18:43:42+00:00

i’ve implemented this pagination class for search.php page in a separate file called class.pagination.php

  • 0

i’ve implemented this pagination class for search.php page in a separate file called class.pagination.php, but when i execute the search page, nothing happens. it just displays a blank page.

this is my search.php file, where i’m calling this class:

    <?php


    include 'config.php';
    require ('class.pagination.php');


    $search_result = "";

    $search_result = $_GET["q"];
    $search_result = trim($search_result);

    //Check if the string is empty
    if ($search_result == "") {
      echo  "<p class='error'>Search Error. Please Enter Your Search Query.</p>" ;
      exit();
          }


   //search query for multiple keywords 
    if(!empty($search_result))
    {
      // the table to search
      $table = "thquotes";
      // explode search words into an array
      $arraySearch = explode(" ", $search_result);
      // table fields to search
      $arrayFields = array(0 => "cQuotes");
      $countSearch = count($arraySearch);
      $a = 0;
      $b = 0;
      $query = "SELECT cQuotes, vAuthor, cArabic, vReference FROM ".$table." WHERE (";
      $countFields = count($arrayFields);
      while ($a < $countFields)
      {
        while ($b < $countSearch)
        {
          $query = $query."$arrayFields[$a] LIKE '%$arraySearch[$b]%'";
          $b++;
          if ($b < $countSearch)
          {
            $query = $query." AND ";
          }
        }
        $b = 0;
        $a++;
        if ($a < $countFields)
        {
          $query = $query.") OR (";
        }
      }
      $query = $query.")";
      $result = mysql_query($query, $conn)
      or die ('Error: '.mysql_error());

      $totalrows = mysql_num_rows($result);

      if($totalrows < 1)
      {
        echo '<span class="error2">No matches found for "'.$search_result.'"</span>';
      }
      else
      {

    ?>

    <div class="caption">Search Results</div>
    <div class="center_div">
    <table>
        <?php while ($row= mysql_fetch_array($result, MYSQL_ASSOC)) {
            $cQuote =  highlightWords(htmlspecialchars($row['cQuotes']), $search_result);
            ?>
            <tr>
            <td style="text-align:right; font-size:15px;"><?php h($row['cArabic']); ?></td>
                <td style="font-size:16px;"><?php echo $cQuote; ?></td>
                <td style="font-size:12px;"><?php h($row['vAuthor']); ?></td>
                <td style="font-size:12px; font-style:italic; text-align:right;"><?php h($row['vReference']); ?></td>
            </tr>
        <?php } ?>
    </table>
    </div>

    <?php
    }
    }
    else {
        exit();
    }

    //Setting Pagination
    $pagination = new pagination();
    $pagination->byPage = 5;
    $pagination->rows = $totalrows; // number of records in a table-back mysql_num_rows () instance or another, you have to play
    $from = $pagination->fromPagination(); // sql used for applications such LIMIT $ from, $ pagination-> byPage
    $pages = $pagination->pages();

    if(isset($pages)) {?>
    <div class="pagination">
        <?foreach ($pages as $key){?>
        <?if($key['current'] == 1) {?>
        <a href="?p=<?=$key['p']?>" class="active"><?=$key['page']?></a>
        <?} else {?>
        <a href="?p=<?=$key['p']?>" class="inactive"><?=$key['page']?></a>
        <?}?>
        <?}?>
    </div>
    <?}
    //End Pagination
    ?>
  • 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-14T18:43:43+00:00Added an answer on May 14, 2026 at 6:43 pm

    Try to echo something before the includes.

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

Sidebar

Ask A Question

Stats

  • Questions 379k
  • Answers 379k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Your current approach probably won't do what you want. When… May 14, 2026 at 9:25 pm
  • Editorial Team
    Editorial Team added an answer The methods underscore and humanize are designed for conversions between… May 14, 2026 at 9:25 pm
  • Editorial Team
    Editorial Team added an answer You could look into using flowplayer, it exposes events for… May 14, 2026 at 9:25 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.