Re: [PHP] PHP + MySQL - Load last inserts

2009-03-30 Thread Thijs Lensselink
Sebastian Muszytowski wrote: Hello :) I have some troubles with php and mysql. I have a normal MySQL Query and this returns X 3 rows. Now i want to get the last 3 inserted values. For Example i've inserted A, B, C, D, E I want to get the last inserted values, e.g. E D C (in reversed

Re: [PHP] PHP + MySQL - Load last inserts

2009-03-30 Thread Marc
I have some troubles with php and mysql. I have a normal MySQL Query and this returns X 3 rows. Now i want to get the last 3 inserted values. For Example i've inserted A, B, C, D, E I want to get the last inserted values, e.g. E D C (in reversed order) So how to do this? I already searched

Re: [PHP] PHP + MySQL - Load last inserts

2009-03-30 Thread Sebastian Muszytowski
Thijs Lensselink schrieb: Sebastian Muszytowski wrote: Hello :) I have some troubles with php and mysql. I have a normal MySQL Query and this returns X 3 rows. Now i want to get the last 3 inserted values. For Example i've inserted A, B, C, D, E I want to get the last inserted values,

Re: [PHP] PHP + MySQL - Load last inserts

2009-03-30 Thread haliphax
On Mon, Mar 30, 2009 at 7:55 AM, Sebastian Muszytowski s.muszytow...@googlemail.com wrote: Thijs Lensselink schrieb: Sebastian Muszytowski wrote: Hello :) I have some troubles with php and mysql.  I have a normal MySQL Query and this returns X 3 rows. Now i want to get the last 3

Re: [PHP] PHP + MySQL - Load last inserts

2009-03-30 Thread Sebastian Muszytowski
haliphax schrieb: [..cut...] Except when your primary key value rolls over, or fills a gap between two other rows that was left when a row was deleted/moved/etc... there has got to be a better way than grabbing rows in descending order based on the auto_increment value. Are you doing the

RE: [PHP] PHP + MySQL - Load last inserts

2009-03-30 Thread abdulazeez alugo
Date: Mon, 30 Mar 2009 14:55:08 +0200 From: s.muszytow...@googlemail.com To: p...@addmissions.nl CC: php-general@lists.php.net Subject: Re: [PHP] PHP + MySQL - Load last inserts Thijs Lensselink schrieb: Sebastian Muszytowski wrote: Hello :) I have some troubles with php

Re: [PHP] PHP + MySQL - Load last inserts

2009-03-30 Thread haliphax
On Mon, Mar 30, 2009 at 9:13 AM, Sebastian Muszytowski s.muszytow...@googlemail.com wrote: haliphax schrieb: [..cut...] Except when your primary key value rolls over, or fills a gap between two other rows that was left when a row was deleted/moved/etc... there has got to be a better way

Re: [PHP] PHP + MySQL - Load last inserts

2009-03-30 Thread Chris
haliphax wrote: On Mon, Mar 30, 2009 at 9:13 AM, Sebastian Muszytowski s.muszytow...@googlemail.com wrote: haliphax schrieb: [..cut...] Except when your primary key value rolls over, or fills a gap between two other rows that was left when a row was deleted/moved/etc... there has got to be a

Re: [PHP] PHP + MySQL - Load last inserts

2009-03-30 Thread haliphax
On Mon, Mar 30, 2009 at 5:10 PM, Chris dmag...@gmail.com wrote: haliphax wrote: On Mon, Mar 30, 2009 at 9:13 AM, Sebastian Muszytowski s.muszytow...@googlemail.com wrote: haliphax schrieb: [..cut...] Except when your primary key value rolls over, or fills a gap between two other rows

Re: [PHP] PHP + MySQL - Load last inserts

2009-03-30 Thread Chris
The physical order of the rows changed (as you can see) but it does not re-use the id's that were deleted. Ordering by the id will get you the last bunch inserted. If you're using innodb you'll have to be aware it's transaction specific, if you're using myisam it will be system wide. I'll