PS: welcome back, Volka
auto_increment
Moderator: General Moderators
volka wrote:I strongly advise against tempering with auto_increment fields - esp. if it's only to have continuous values. There are good reasons why they behave this way. Speed: your renumbering takes a considerable amount of time, ever more with an increasing amount of records. Uniqueness: an auto_increment field is supposed to identify a record, but it doesn't if you assign new ids. Yesterday id=2 identified record a, today it's record b - hmmmm.
There's another property assigned to the records which is always continuous. The position within the result set. You may use it within the database, e.g.
SELECT a,b, from tablename WHERE <condition> LIMIT 4,2
(get records 5 to 6 that fulfill the condition) and/or within your script/program
ok but how would i say the following
if page =1 get 1-5
if page =2 get 6-10 etc.... right now i have $page is the page im on and get $page * 5
the only problem is if the 3rd item in the database has an id of 27 for example because ive deleted alot of items i say get where id >6 limit 5 for example... it returns nothing right.. or would it keep returning items until 5 are returned?