RE: [PHP] auto_increment $value
| From: | Michael Roger C. Bianan | Date: | Tue, 11 Mar 2003 14:20:23 +0000 |
| Subject: | RE: [PHP] auto_increment $value | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-139041@lists.php.net to get a copy of this message | ||
I think this is facing a bigger issue when it comes to
Concurrency. When two or more apps in a given time pops
the auto_increment or mysql_insert_id (they will get
THE SAME ID assuming no other transaction issued an
INSERT sql to the table while retrieving the ID).
Now, I don't know if this has a major effect on your
applications but when your programs get bigger and
larger... basing algos on things like this just won't
work.
Just be very careful though.
Thanks,
Miches:)
-----Original Message-----
From: John Taylor-Johnston [mailto:taylorjo@collegesherbrooke.qc.ca]
Sent: Monday, March 10, 2003 1:41 PM
To: Eddie Lien
Cc: php-general@lists.php.net
Subject: Re: [PHP] auto_increment $value
Necessary, or at least cleaner, if there are less than 5 records in your database.
> Why don't you just use "select * from table order by id DESC limit 0,5"?
>
> I don't see any necessary to get the auto_increment value.
> > Anyone know how to get the auto_increment $value out of a mysql table.
> > I'm thinking it is in mysql_fetch_array but don't see how to get it.
> > > $SQL = "SELECT * FROM table ORDER BY id asc LIMIT $autoindex -5 ,5;";
> > > I would like to get the autoindex value of my table and use it in my
> SQL. Can I get the autoindex? :) How?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php