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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T21:04:43+00:00 2026-06-04T21:04:43+00:00

I have been using paginating classes when I did before the query the traditional

  • 0

I have been using paginating classes when I did before the query the traditional way, but now that I have come to do the queries using prepared statements, via the $stmt->fetch() statement, I don’t know how to paginate now. I have been looking around and checking the stackoverflow literature and it seems that there is some kind of ready solution for it, some commands or some : sort-> stuff.

How do you paginate what comes out of this loop? Are there some commands within the “world of prepared statements”? any link, page or web where that is shown?

while( $stmt->fetch() )
    {
        printf("%s%s%s%s", $Email, $Webpage, $Telephone, $Mobile);
    }
  • 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-04T21:04:44+00:00Added an answer on June 4, 2026 at 9:04 pm

    Method 1: get_result():

    *Note: This method only works with PHP >= 5.3, having the mysqlnd native driver.

    Assuming this was done with MySQLi and you have bound these variables as result vars via bind_result(), I would instead use get_result() to transfer it into a MySQLi result resource, and fetch the rows as arrays onto an array containing all rows. Then use any pagination method or plugin you would normally use on array data:

    // Don't use bind_result()...
    // execute your statement
    $stmt->execute();
    // Get result set into a MySQLi result resource
    $result = $stmt->get_result();
    
    // array to hold all results
    $rowset = array();
    // And fetch with a while loop
    while ($row = $result->fetch_assoc()) {
      $rowset[] = $row;
    }
    

        var_dump($rowset);

    Now use $rowset as a 2D array, with which you can use any pagination method that operates on regular arrays.

    Method 2: build an array with bound output vars

    If you don’t have the mysqlnd native driver (and hence cannot use get_result(), continue using bind_result() but append all of those onto an array:

    // array to hold all rows
    $rowset = array();
    
    // All results bound to output vars
    while ($stmt->fetch()) {
      // Append an array containing your result vars onto the rowset array
      $rowset[] = array(
        'email' => $Email,
        'webpage' => $Webpage,
        'telephone' => $Telephone,
        'moblile' => $Mobile
      );
    }
    var_dump($rowset);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been using form inheritance for a while now but without doing much
I have been using ajax loaded data for a while now, but I am
I have been using solr search and now I am adding pagination via the
I have been using the following sort: var query = _cityRepository.GetAll( .OrderBy(item => item.RowKey.Substring(0,
I have been using Tperlregex for some time. but today when I try to
I have been using TortoiseSVN for some time and I really like it. I
I have been using Stanford POS Tagger to tag parts of speech in a
I have been using play 1.2.5rc4 for development of one app and I have
I have been using an API to do some work. This is how I
I have been using some Javascript to create a text field once an certain

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.