Jump to content

Recommended Posts

I've go this sql  I'm using to extract records for a page recordset and it works fine for the first 1-5 records. For the next 6-10 records however, it shows 7 records, and the page after that shows only 2. The total num of records in the database is 13 and running a query without LIMIT confirms this.

 

SELECT * FROM GA_Gig, GA_Town, GA_Venue, GA_User WHERE GA_Gig.townID = GA_Town.townID AND GA_Gig.venueID = GA_Venue.venueID AND GA_Gig.username = GA_User.username AND GA_Town.region = 'North East' ORDER BY GA_Gig.date LIMIT 6,10

 

Please someone advice me on how I can fix this.

Link to comment
https://forums.phpfreaks.com/topic/129144-solved-problem-using-limit-function/
Share on other sites

LIMIT definition:

 

Definition: Limit is used to limit your MySQL query results to those that fall within a specified range. You can use it to show the first X number of results, or to show a range from X - Y results. It is phrased as Limit X, Y and included at the end of your query. X is the starting point (remember the first record is 0) and Y is the duration (how many records to display).

Oh, right. Silly of me. I thought the second argument was for the record you would want the LIMIT to stop at.

 

Many thanks

 

Haha, yeah I did the same thing with a DB at my work.  I had a recursive function to incrementally grab records and I kept clogging the server because I was trying to update almost 100,000 records at once  :o

 

Sometimes it's better to learn the hard way because I will NEVER do that again.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.