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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T06:48:24+00:00 2026-06-16T06:48:24+00:00

For some reason, I can’t get this to work. It returns the right amount

  • 0

For some reason, I can’t get this to work. It returns the right amount of rows but the data seems to be empty, no matter what I try:

$page = intval(trim($_GET['p']));
if($page <= 0)
    $page = 1;
$showcount = 15;
$limit_start = (int)(($page-1)*$showcount);

$stmt_scorelist = $dbh->prepare("
    SELECT user_id,min_time 
    FROM scoretable 
    WHERE type_id = :type AND level_id = :level_id 
    GROUP BY user_id 
    ORDER BY MIN(min_time) ASC 
    LIMIT :limit_start, :showcount
");
$stmt_scorelist->bindParam(':type', $type);
$stmt_scorelist->bindParam(':level_id', $level_id);
$stmt_scorelist->bindValue(':limit_start', (int)$limit_start, PDO::PARAM_INT);
$stmt_scorelist->bindValue(':showcount', (int)$showcount, PDO::PARAM_INT);

I’ve tried to enter numbers explicitly like this:

$stmt_scorelist->bindValue(':limit_start', 0, PDO::PARAM_INT);
$stmt_scorelist->bindValue(':showcount', 15, PDO::PARAM_INT);

It always returns the correct amount of rows, but the data seems to be empty.
I’ve also tried both (int)$var and intval(trim($var)), I’ve tried to use bindParam() instead of bindValue(), but none works.

The one thing that works, is if I comment the bound values and replace them with pure numbers in the statement, it works just as intended, the right amount of rows and the data returns:

$stmt_scorelist = $dbh->prepare("
    SELECT user_id,min_time 
    FROM scoretable 
    WHERE type_id = :type AND level_id = :level_id 
    GROUP BY user_id 
    ORDER BY MIN(min_time) ASC 
    LIMIT 0, 15
");
$stmt_scorelist->bindParam(':type', $type);
$stmt_scorelist->bindParam(':level_id', $level_id);
//$stmt_scorelist->bindValue(':limit_start', 0, PDO::PARAM_INT);
//$stmt_scorelist->bindValue(':showcount', 14, PDO::PARAM_INT);

What am I doing wrong? I’ve seen multiple people have the same issues, but none of the solutions they found seems to work for me.

  • 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-16T06:48:26+00:00Added an answer on June 16, 2026 at 6:48 am

    This solved the issue:

    $dbh->setAttribute( PDO::ATTR_EMULATE_PREPARES, false );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For some reason I can get this to work, using single proxy everything seems
For some reason I can't get this to work. It pulls the name and
For some reason I can't get this to work at all. I have read
For some reason i can't seem to get this right ok i have 2
This should be pretty simple but for some reason I can't get this value
For some reason I can't get this script to run when I add the
I know PHP 5 already supports SQLite but for some reason I can't get
For some reason I can't seem to get this particular web page's contents via
For some reason I can't seem to get the basic example to work, provided
For some reason I can't get my SVG filters to work in Firefox. 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.