Re: [PHP-DB] Hi, simple question

2003-07-01 Thread Oscar Rylin
see mysql_insert_id($link_identifier) -- rylin Patrik Fomin wrote: Hi, im adding a post to the database, is there any way to retrive back the ID for the post that i just created? the id is auto_increment and primary key. like $sql = "insert into test (namn, www) values('test', 'test.com')"; my

RE: [PHP-DB] Hi, simple question

2003-07-01 Thread Nick Pappas
There's two methods I use, depending on the situations I need. What it sounds like you want is this: $sql = "SELECT id FROM test ORDER BY id DESC LIMIT 1"; Often when I need to know the next avaliable ID prior to making an insert, I'll do this-- $sql ="SHOW TABLE STATUS LIKE 'test'"; $array =