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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T10:29:38+00:00 2026-06-10T10:29:38+00:00

I have a script of pagination. When I run, it show the following error:

  • 0

I have a script of pagination. When I run, it show the following error:

Warning: mysql_result() expects parameter 1 to be resource, boolean given in C:\wamp\www\folder\index.php on line 6

Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in C:\wamp\www\folder\index.php on line 12

Here’s my script:

<?php
include 'db.inc.php';
$per_page = 2;

$pages_query = mysql_query("SELECT COUNT 'id' FROM 'names'");
$pages = ceil(mysql_result($pages_query,0) /$per_page);

$page = (isset($_GET['page'])) ? (int)$_GET['page'] : 1;
$start = ($page - 1) * $per_page;

$query = mysql_query("SELECT 'name' FROM 'names' LIMIT $start, $per_page");
while ($query_row = mysql_fetch_assoc($query)) {
echo '<p>', $query_row['name'],'</p>';
}
if($pages >=1 && $page <= $pages){
for ($x=1; $x<=$pages; $x++){
echo  ($x == $page) ? '<strong> <a href="?page='.$X.'">'.$x.'</a></strong> ' : '<a href="?page='.$X.'">'.$x.'</a> ';
}
}
?>

At last i found my problem. It was for $X.
The correct is:

echo  ($number == $page) ? '<strong> <a href="?page='.$number.'">'.$number.'</a></strong> ' : '<a href="?page='.$number.'">'.$number.'</a> ';
  • 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-06-10T10:29:39+00:00Added an answer on June 10, 2026 at 10:29 am

    First you need to debug your script and use mysql_error(). Then fix your sql errors.

    It will then become obvious that example count 'id' should be count(id)

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

Sidebar

Related Questions

I have an events calendar written in PHP, with the following pagination script that
I have this script that run to fix my menu bar to the browser
I have a pagination script that displays a list of all pages like so:
I have a pagination script, which can be seen here: http://www.automotori6282.tk/phpsandbox/ This is the
I have very basic pagination script and search form with ~4 fields, and action=get
I have a pagination script which I have posted below, the problem is I
I have a simple pagination script. When you click the next button multiple times
I am receiving a pagination error in my php script. The query works fine
I have a few questions regarding a PHP Pagination Script For Flat File Database
I have a simple pagination script: $product_nr = count($query); // counts the number of

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.