close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

MySQLi record count using LIMIT keyword

Thread began 9/27/2014 12:29 pm by CraigR | Last modified 9/30/2014 1:50 pm by Jason Byrnes | 1125 views | 17 replies |

CraigRBeta Tester

MySQLi wrong record count when using LIMIT keyword

I have a mySQLi recrdset from a table with 13 rows, but I added a LIMIT keyword so only the first 6 rows are returned,

This works, but if I add the server behavior 'MySQLi Display Total Records' , the value returned is 13, not 6

Sign in to reply to this post

Jason ByrnesWebAssist

I'll need to troubleshoot directly, see the private message section.

Sign in to reply to this post

CraigRBeta Tester

PM

Sign in to reply to this post

Jason ByrnesWebAssist

When using a repeat region, the limit is set to the number of records you select to return.

what this means is:
by default when you create a recordset, the limit is set to 1.

This gets changed when you apply the repeat region. you say that when you applied the repeat region, the limit was set to 0, this would happen if you selected to return all rows in the repeat region behavior.

so, create the basic recordset with out the limit applied, add the column binding to your page with the repeat region around it, in the repeat region, set the number of records to return to 4. this will update the limit in the recordset to 4.

to show the current starting record number and the ending record number, use the WebAssist -> MySQLi -> Display Record Count -> MySQLI Display Starting Record Number and MySQLI Display Ending Record Number behaviors

to page through the recordset use the MySQLi recordset paging controls

Sign in to reply to this post

CraigRBeta Tester

Ok, I get it.

I can calculate the number of rows returned by subtracting the ->StartRow from the ->LastRow

The total rows calculation does not take into account the LIMIT keyword at all

With the offset, how do I return, (for example) records 5-8 from my table with MYSQLi ?

Sign in to reply to this post

Jason ByrnesWebAssist

using the MySQLI Display Starting Record Number and MySQLI Display Ending Record Number behaviors

Sign in to reply to this post

CraigRBeta Tester

sorry, not getting it.

my sql statement is as follows...

$Recordset1 = new WA_MySQLi_RS("Recordset1",$PowerCMSConnection_i,4);
$Recordset1->setQuery("SELECT tbltestimonials.* FROM tbltestimonials");
$Recordset1->execute();

so my limit is 4

Can you show me how to show rows 5-8 in a repeat region, is the offset done in the sql statement or in the repeat ?

Sign in to reply to this post

Jason ByrnesWebAssist

the offset is done using the paging controls to add the show next page link

Sign in to reply to this post

CraigRBeta Tester

so how do i show rows 5-8 in a repeat region, on a single page ?

Sign in to reply to this post

Jason ByrnesWebAssist

add the paging controls to your page so that you can click the next link, after clicking the next link it will show records 5-8. next again will show 9-12 etc.

Sign in to reply to this post
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...