Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP

Hazem mosaad
Hazem mosaad
15,384 Points

some problem

SELECT * FROM books  ORDER BY REPLACE  ( REPLACE  (REPLACE (title,'The ', '') , 'A ', ''), 'An ', '') LIMIT 10 OFFSET 1;

Challenge link : (https://teamtreehouse.com/library/integrating-php-with-databases/limiting-records-in-sql/limit-and-offset)

Peter Hatzer
Peter Hatzer
20,837 Points

Hi Hazem,

The limit offset mysql is tricking one, so this is how you work out the offset: (page number - 1) * limit

I have added examples below:

limit = 10

offset for first page: (1 - 1) * 10 = 0

offset for second page: (2 - 1 ) * 10 = 10

I hop this makes sense for you.

Peter

Hazem mosaad
Hazem mosaad
15,384 Points

Thanks For Reply Peter !So The Offset in this challenge = 1 to get the second page i under stand this but wrong in the challenge !

Peter Hatzer
Peter Hatzer
20,837 Points

In my example above the offset of the first page is equal to : 0 and the second page is: 10

The first page offset is always going to: 0

Am trying to guide more so then giving the answer lol

Hazem mosaad
Hazem mosaad
15,384 Points

I Under standing You :) Thank you peter ! i not want the answer lol i just want to understand thanks !

Peter Hatzer
Peter Hatzer
20,837 Points

No problem Hazem, keep on coding :)

2 Answers

Dzims Dreijers
Dzims Dreijers
9,173 Points

You aren't wasting your time! That's why they are called challenges, do you think there won't be any challenges in real world situations? You can't just simply watch one video after another video, especially 10 hours per day! You have to focus on every each of them and let the information sink in. I don't believe you can qualitatively learn by learning 10 hours per day, especially saying that code challenges waste your time. It shows your attitude!

Hazem mosaad
Hazem mosaad
15,384 Points

I Mean Some Challenges Work In My Local host And Not Work In The Challenges Code And I Stay this Number Of Hour Not in Tree house I create some websites with my new skills not only in tree houses video You under stand me ?!

Dzims Dreijers
Dzims Dreijers
9,173 Points

Yes, that explains everything!