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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T12:32:06+00:00 2026-06-09T12:32:06+00:00

As you can see I’m trying to fetch rows from table while using prepared

  • 0

As you can see I’m trying to fetch rows from table while using prepared statements.

$stmt = $conn->prepare("SELECT * FROM table ORDER BY date DESC LIMIT ?, 10");
$stmt->bindParam(1, $row_start, PDO::PARAM_INT);
$stmt->execute();

while($row = $stmt->fetch()) {
echo $row['title'];
echo $row['name'];
}

It doesn’t echo anything.

Edit: var_dump is showing this log :

“You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use
near ”0′, 10′ at line 1″ }

Edit 2: Here is how I declare my $row_start

$row_start = "0";
if (isset($_GET['page']) && is_numeric($_GET['page']) && $_GET['page'] != "0" )
{
$row_start = $_GET['page'];
if ($row_start == "1") {
$row_start = "0";
}else{
$row_start = ($row_start-1) * 10;
}                       
}
  • 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-09T12:32:08+00:00Added an answer on June 9, 2026 at 12:32 pm

    By default, the value type will be string.

    You can set it to an integer like this:

    $stmt->bindParam(1, $row_start, PDO::PARAM_INT);
    

    Update:

    Even though you are forcing it to INT, it’s still passing it as a string.

    Look at your error message:

    near ''0', 10' at line 1" }
    

    And specifically the ending ' after 0, indicating it is a string.

    0'
    

    Update

    Manually typecasting the variable is needed, even if you pass the expected PDO type:

    $limit = (int) 1;
    $limit2 = (int) 1;
    
    
    $stmt = $pdo->prepare("SELECT * FROM Table LIMIT :limit, :offset");
    $stmt->bindParam(":limit", $limit, PDO::PARAM_INT);
    $stmt->bindParam(":offset", $limit2, PDO::PARAM_INT);
    $stmt->execute();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I can see 2 ways of implementing let bindings. First, as known from SICP
I can see that using maatkit I can export the data as comma or
I can see why someone would want to export by ordinal only (i.e. using
We can see the growth of systems using peer to peer principles. But there
We can see schema for all tables and views by: SELECT * FROM INFORMATION_SCHEMA.TABLES
I can see that there are ways to convert from a Java list to
I can see this curious behaviour from the garbage collector public class A {
We can see many HTML page using src=//example.com/myjavascript.js to include a .js and let
I can see how to convert from LocalDate to epoch date, but how do
I can see the Graphical Layout of the XML file within the /res/layout folder,

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.