NYCPHP Meetup

NYPHP.org

[nycphp-talk] PHP/MySQL environment problem??

csnyder chsnyder at gmail.com
Mon Mar 3 13:59:31 EST 2008


On Mon, Mar 3, 2008 at 1:13 PM, David Krings <ramons at gmx.net> wrote:
> PaulCheung wrote:
>  I looked over the code and a few things struck me odd (which doesn't mean they
>  are wrong!).

I didn't have that much patience. ;-)

I wonder why you're trying to count the rows in the database in order
to set up a simple auto-increment?
http://dev.mysql.com/doc/refman/5.0/en/example-auto-increment.html

If for some reason your table can't include an AUTO INCREMENT field,
perhaps you could just "SELECT id FROM table ORDER BY id DESC LIMIT 1"
to get the highest id number, and then add one to it.


-- 
Chris Snyder
http://chxo.com/



More information about the talk mailing list